国内流行的内容管理系统(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.

47 lines
1.7KB

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