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

57 lines
2.1KB

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