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

51 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 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_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. {
  31. unset($dtp);
  32. return '';
  33. }
  34. else
  35. {
  36. $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);
  37. foreach($dtp->CTags as $tagid=>$ctag)
  38. {
  39. if(isset($row[$ctag->GetName()])) $dtp->Assign($tagid,$row[$ctag->GetName()]);
  40. }
  41. $revalue = $dtp->GetResult();
  42. unset($dtp);
  43. return $revalue;
  44. }
  45. }