国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.0KB

  1. <?php if(!defined('DEDEINC')) exit('Request Error!');
  2. /**
  3. * 单页文档调用标签
  4. *
  5. * @version $Id: likesgpage.lib.php 1 9:29 2010年7月6日Z tianya $
  6. * @package DedeCMS.Taglib
  7. * @copyright Copyright (c) 2020, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. /*>>dede>>
  12. <name>单页文档调用标签</name>
  13. <type>全局标记</type>
  14. <for>V55,V56,V57</for>
  15. <description>单页文档调用标签</description>
  16. <demo>
  17. {dede:likespage row=''/}
  18. </demo>
  19. <attributes>
  20. <iterm>row:调用条数</iterm>
  21. </attributes>
  22. >>dede>>*/
  23. function lib_likesgpage(&$ctag,&$refObj)
  24. {
  25. global $dsql;
  26. //把属性转为变量,如果不想进行此步骤,也可以直接从 $ctag->CAttribute->Items 获得,这样也可以支持中文名
  27. $attlist="row|8";
  28. FillAttsDefault($ctag->CAttribute->Items,$attlist);
  29. extract($ctag->CAttribute->Items, EXTR_SKIP);
  30. $innertext = trim($ctag->GetInnerText());
  31. $aid = (isset($refObj->Fields['aid']) ? $refObj->Fields['aid'] : 0);
  32. $revalue = '';
  33. if($innertext=='') $innertext = GetSysTemplets("part_likesgpage.htm");
  34. $likeid = (empty($refObj->Fields['likeid']) ? 'all' : $refObj->Fields['likeid']);
  35. $dsql->SetQuery("SELECT aid,title,filename FROM `#@__sgpage` WHERE likeid LIKE '$likeid' LIMIT 0,$row");
  36. $dsql->Execute();
  37. $ctp = new DedeTagParse();
  38. $ctp->SetNameSpace('field','[',']');
  39. $ctp->LoadSource($innertext);
  40. while($row = $dsql->GetArray())
  41. {
  42. if($aid != $row['aid'])
  43. {
  44. $row['url'] = $GLOBALS['cfg_cmsurl'].'/'.$row['filename'];
  45. foreach($ctp->CTags as $tagid=>$ctag) {
  46. if(!empty($row[$ctag->GetName()])) $ctp->Assign($tagid,$row[$ctag->GetName()]);
  47. }
  48. $revalue .= $ctp->GetResult();
  49. }
  50. else
  51. {
  52. $revalue .= '<dd class="cur"><span>'.$row['title'].'</span></dd>';
  53. }
  54. }
  55. return $revalue;
  56. }