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

64 lines
2.2KB

  1. <?php if(!defined('DEDEINC')) exit('Request Error!');
  2. /**
  3. * 按排序位置的获取单个栏目的链接信息
  4. *
  5. * @version $Id: autochannel.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_autochannel(&$ctag,&$refObj)
  12. {
  13. global $dsql;
  14. $attlist='partsort|0,typeid=-1';
  15. FillAttsDefault($ctag->CAttribute->Items,$attlist);
  16. extract($ctag->CAttribute->Items, EXTR_SKIP);
  17. $innertext = trim($ctag->GetInnerText());
  18. $topid = $typeid;
  19. $sortid = $partsort;
  20. if($topid=='-1' || $topid=='')
  21. {
  22. $topid = ( isset($refObj->TypeLink->TypeInfos['id']) ? $refObj->TypeLink->TypeInfos['id'] : 0);
  23. }
  24. if(empty($sortid)) $sortid = 1;
  25. $getstart = $sortid - 1;
  26. $row = $dsql->GetOne("SELECT id,typename FROM `#@__arctype` WHERE reid='{$topid}' AND
  27. ispart<2 AND ishidden<>'1' ORDER BY sortrank asc limit $getstart,1");
  28. if(!is_array($row) ) return '';
  29. else $typeid = $row['id'];
  30. if(trim($innertext)=='') $innertext = GetSysTemplets('part_autochannel.htm');
  31. $row = $dsql->GetOne("SELECT id,typedir,isdefault,defaultname,ispart,namerule2,typename,moresite,siteurl,sitepath
  32. FROM `#@__arctype` WHERE id='$typeid' ");
  33. if(!is_array($row)) return '';
  34. $dtp = new DedeTagParse();
  35. $dtp->SetNameSpace('field','[',']');
  36. $dtp->LoadSource($innertext);
  37. if(!is_array($dtp->CTags))
  38. {
  39. unset($dtp);
  40. return '';
  41. }
  42. else
  43. {
  44. $row['typelink'] = GetTypeUrl($row['id'],MfTypedir($row['typedir']),$row['isdefault'],
  45. $row['defaultname'],$row['ispart'],$row['namerule2'],$row['siteurl'],$row['sitepath']);
  46. foreach($dtp->CTags as $tagid=>$ctag)
  47. {
  48. if(isset($row[$ctag->GetName()])) $dtp->Assign($tagid,$row[$ctag->GetName()]);
  49. }
  50. $revalue = $dtp->GetResult();
  51. unset($dtp);
  52. return $revalue;
  53. }
  54. }