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

66 lines
2.0KB

  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) 2007 - 2020, DesDev, Inc.
  8. * @license http://help.dedecms.com/usersguide/license.html
  9. * @link http://www.dedecms.com
  10. */
  11. /*>>dede>>
  12. <name>指定栏目</name>
  13. <type>全局标记</type>
  14. <for>V55,V56,V57</for>
  15. <description>表示指定的单个栏目的链接</description>
  16. <demo>
  17. {dede:type}
  18. <a href="[field:typelink /]">[field:typename /]</a>
  19. {/dede:type}
  20. </demo>
  21. <attributes>
  22. <iterm>typeid:指定栏目ID</iterm>
  23. </attributes>
  24. >>dede>>*/
  25. function lib_type(&$ctag,&$refObj)
  26. {
  27. global $dsql,$envs;
  28. $attlist='typeid|0';
  29. FillAttsDefault($ctag->CAttribute->Items,$attlist);
  30. extract($ctag->CAttribute->Items, EXTR_SKIP);
  31. $innertext = trim($ctag->GetInnerText());
  32. if($typeid==0) {
  33. $typeid = ( isset($refObj->TypeLink->TypeInfos['id']) ? $refObj->TypeLink->TypeInfos['id'] : $envs['typeid'] );
  34. }
  35. if(empty($typeid)) return '';
  36. $row = $dsql->GetOne("SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
  37. FROM `#@__arctype` WHERE id='$typeid' ");
  38. if(!is_array($row)) return '';
  39. if(trim($innertext)=='') $innertext = GetSysTemplets("part_type_list.htm");
  40. $dtp = new DedeTagParse();
  41. $dtp->SetNameSpace('field','[',']');
  42. $dtp->LoadSource($innertext);
  43. if(!is_array($dtp->CTags))
  44. {
  45. unset($dtp);
  46. return '';
  47. }
  48. else
  49. {
  50. $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);
  51. foreach($dtp->CTags as $tagid=>$ctag)
  52. {
  53. if(isset($row[$ctag->GetName()])) $dtp->Assign($tagid,$row[$ctag->GetName()]);
  54. }
  55. $revalue = $dtp->GetResult();
  56. unset($dtp);
  57. return $revalue;
  58. }
  59. }