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

48 lines
1.6KB

  1. <?php if (!defined('DEDEINC')) exit('Request Error!');
  2. /**
  3. * 指定的单个栏目的链接标签
  4. *
  5. * @version $Id: type.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_type(&$ctag, &$refObj)
  12. {
  13. global $dsql, $envs;
  14. $attlist = 'typeid|0';
  15. FillAttsDefault($ctag->CAttribute->Items, $attlist);
  16. extract($ctag->CAttribute->Items, EXTR_SKIP);
  17. $innertext = trim($ctag->GetInnerText());
  18. if ($typeid == 0) {
  19. $typeid = (isset($refObj->TypeLink->TypeInfos['id']) ? $refObj->TypeLink->TypeInfos['id'] : $envs['typeid']);
  20. }
  21. if (empty($typeid)) return '';
  22. $row = $dsql->GetOne("SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
  23. 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. }