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

68 lines
2.2KB

  1. <?php
  2. if (!defined('DEDEINC')) exit('dedebiz');
  3. /**
  4. * 按排序位置的获取单个栏目的链接信息
  5. *
  6. * @version $Id: autochannel.lib.php 1 9:29 2010年7月6日Z 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
  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. unset($dtp);
  39. return '';
  40. } else {
  41. $row['typelink'] = GetTypeUrl(
  42. $row['id'],
  43. MfTypedir($row['typedir']),
  44. $row['isdefault'],
  45. $row['defaultname'],
  46. $row['ispart'],
  47. $row['namerule2'],
  48. $row['siteurl'],
  49. $row['sitepath']
  50. );
  51. foreach ($dtp->CTags as $tagid => $ctag) {
  52. if (isset($row[$ctag->GetName()])) $dtp->Assign($tagid, $row[$ctag->GetName()]);
  53. }
  54. $revalue = $dtp->GetResult();
  55. unset($dtp);
  56. return $revalue;
  57. }
  58. }