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

50 lines
1.7KB

  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. function lib_likesgpage(&$ctag,&$refObj)
  12. {
  13. global $dsql;
  14. //把属性转为变量,如果不想进行此步骤,也可以直接从 $ctag->CAttribute->Items 获得,这样也可以支持中文名
  15. $attlist="row|8";
  16. FillAttsDefault($ctag->CAttribute->Items,$attlist);
  17. extract($ctag->CAttribute->Items, EXTR_SKIP);
  18. $innertext = trim($ctag->GetInnerText());
  19. $aid = (isset($refObj->Fields['aid']) ? $refObj->Fields['aid'] : 0);
  20. $revalue = '';
  21. if($innertext=='') $innertext = GetSysTemplets("part_likesgpage.htm");
  22. $likeid = (empty($refObj->Fields['likeid']) ? 'all' : $refObj->Fields['likeid']);
  23. $dsql->SetQuery("SELECT aid,title,filename FROM `#@__sgpage` WHERE likeid LIKE '$likeid' LIMIT 0,$row");
  24. $dsql->Execute();
  25. $ctp = new DedeTagParse();
  26. $ctp->SetNameSpace('field','[',']');
  27. $ctp->LoadSource($innertext);
  28. while($row = $dsql->GetArray())
  29. {
  30. if($aid != $row['aid'])
  31. {
  32. $row['url'] = $GLOBALS['cfg_cmsurl'].'/'.$row['filename'];
  33. foreach($ctp->CTags as $tagid=>$ctag) {
  34. if(!empty($row[$ctag->GetName()])) $ctp->Assign($tagid,$row[$ctag->GetName()]);
  35. }
  36. $revalue .= $ctp->GetResult();
  37. }
  38. else
  39. {
  40. $revalue .= '<dd class="cur"><span>'.$row['title'].'</span></dd>';
  41. }
  42. }
  43. return $revalue;
  44. }