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

55 lines
1.7KB

  1. <?php
  2. if (!defined('DEDEINC')) exit('dedebiz');
  3. /**
  4. * 自定义宏标记调用标签
  5. *
  6. * @version $Id: mytag.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_mytag(&$ctag, &$refObj)
  13. {
  14. $attlist = "typeid|0,name|,ismake|no";
  15. FillAttsDefault($ctag->CAttribute->Items, $attlist);
  16. extract($ctag->CAttribute->Items, EXTR_SKIP);
  17. if (trim($ismake) == '') $ismake = 'no';
  18. $body = lib_GetMyTagT($refObj, $typeid, $name, '#@__mytag');
  19. //编译
  20. if ($ismake == 'yes') {
  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 (
  40. $row['timeset'] == 1
  41. && ($nowtime < $row['starttime'] || $nowtime > $row['endtime'])
  42. ) {
  43. $body = $row['expbody'];
  44. } else {
  45. $body = $row['normbody'];
  46. }
  47. return $body;
  48. }