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

42 lines
1.5KB

  1. <?php
  2. if (!defined('DEDEINC')) exit('dedebiz');
  3. /**
  4. * 指定某个栏目标签
  5. *
  6. * @version $id:type.lib.php 9:29 2010年7月6日 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_type(&$ctag, &$refObj)
  13. {
  14. global $dsql, $envs;
  15. $attlist = 'typeid|0';
  16. FillAttsDefault($ctag->CAttribute->Items, $attlist);
  17. extract($ctag->CAttribute->Items, EXTR_SKIP);
  18. $innertext = trim($ctag->GetInnerText());
  19. if ($typeid == 0) {
  20. $typeid = (isset($refObj->TypeLink->TypeInfos['id']) ? $refObj->TypeLink->TypeInfos['id'] : $envs['typeid']);
  21. }
  22. if (empty($typeid)) return '';
  23. $row = $dsql->GetOne("SELECT * FROM `#@__arctype` WHERE id='$typeid' ");
  24. if (!is_array($row)) return '';
  25. if (trim($innertext) == '') $innertext = GetSysTemplets("part_type_list.htm");
  26. $dtp = new DedeTagParse();
  27. $dtp->SetNameSpace('field', '[', ']');
  28. $dtp->LoadSource($innertext);
  29. if (!is_array($dtp->CTags)) {
  30. unset($dtp);
  31. return '';
  32. } else {
  33. $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);
  34. foreach ($dtp->CTags as $tagid => $ctag) {
  35. if (isset($row[$ctag->GetName()])) $dtp->Assign($tagid, $row[$ctag->GetName()]);
  36. }
  37. $revalue = $dtp->GetResult();
  38. unset($dtp);
  39. return $revalue;
  40. }
  41. }
  42. ?>