国内流行的内容管理系统(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 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 DedeBIZ.Taglib
  7. * @copyright Copyright (c) 2021, 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. require_once(DEDEINC . '/arc.partview.class.php');
  21. $pvCopy = new PartView($typeid);
  22. $pvCopy->SetTemplet($body, "string");
  23. $body = $pvCopy->GetResult();
  24. }
  25. return $body;
  26. }
  27. function lib_GetMyTagT(&$refObj, $typeid, $tagname, $tablename)
  28. {
  29. global $dsql;
  30. if ($tagname == '') return '';
  31. if (trim($typeid) == '') $typeid = 0;
  32. if (!empty($refObj->Fields['typeid']) && $typeid == 0) $typeid = $refObj->Fields['typeid'];
  33. $typesql = $row = '';
  34. if ($typeid > 0) $typesql = " And typeid IN(0," . GetTopids($typeid) . ") ";
  35. $row = $dsql->GetOne(" SELECT * FROM $tablename WHERE tagname LIKE '$tagname' $typesql ORDER BY typeid DESC ");
  36. if (!is_array($row)) return '';
  37. $nowtime = time();
  38. if (
  39. $row['timeset'] == 1
  40. && ($nowtime < $row['starttime'] || $nowtime > $row['endtime'])
  41. ) {
  42. $body = $row['expbody'];
  43. } else {
  44. $body = $row['normbody'];
  45. }
  46. return $body;
  47. }