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

56 lines
1.7KB

  1. <?php if(!defined('DEDEINC')) exit('Request Error!');
  2. /**
  3. * 自定义宏标记调用标签
  4. *
  5. * @version $Id: mytag.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_mytag(&$ctag, &$refObj)
  12. {
  13. $attlist = "typeid|0,name|,ismake|no";
  14. FillAttsDefault($ctag->CAttribute->Items,$attlist);
  15. extract($ctag->CAttribute->Items, EXTR_SKIP);
  16. if(trim($ismake)=='') $ismake = 'no';
  17. $body = lib_GetMyTagT($refObj, $typeid, $name, '#@__mytag');
  18. //编译
  19. if($ismake=='yes')
  20. {
  21. require_once(DEDEINC.'/arc.partview.class.php');
  22. $pvCopy = new PartView($typeid);
  23. $pvCopy->SetTemplet($body,"string");
  24. $body = $pvCopy->GetResult();
  25. }
  26. return $body;
  27. }
  28. function lib_GetMyTagT(&$refObj, $typeid,$tagname,$tablename)
  29. {
  30. global $dsql;
  31. if($tagname=='') return '';
  32. if(trim($typeid)=='') $typeid=0;
  33. if( !empty($refObj->Fields['typeid']) && $typeid==0) $typeid = $refObj->Fields['typeid'];
  34. $typesql = $row = '';
  35. if($typeid > 0) $typesql = " And typeid IN(0,".GetTopids($typeid).") ";
  36. $row = $dsql->GetOne(" SELECT * FROM $tablename WHERE tagname LIKE '$tagname' $typesql ORDER BY typeid DESC ");
  37. if(!is_array($row)) return '';
  38. $nowtime = time();
  39. if($row['timeset']==1
  40. && ($nowtime<$row['starttime'] || $nowtime>$row['endtime']) )
  41. {
  42. $body = $row['expbody'];
  43. }
  44. else
  45. {
  46. $body = $row['normbody'];
  47. }
  48. return $body;
  49. }