国内流行的内容管理系统(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 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 DedeBIZ.Taglib
  7. * @copyright Copyright (c) 2021, 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. $topid = (isset($refObj->TypeLink->TypeInfos['id']) ? $refObj->TypeLink->TypeInfos['id'] : 0);
  22. }
  23. if (empty($sortid)) $sortid = 1;
  24. $getstart = $sortid - 1;
  25. $row = $dsql->GetOne("SELECT id,typename FROM `#@__arctype` WHERE reid='{$topid}' AND
  26. 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
  31. FROM `#@__arctype` WHERE id='$typeid' ");
  32. if (!is_array($row)) return '';
  33. $dtp = new DedeTagParse();
  34. $dtp->SetNameSpace('field', '[', ']');
  35. $dtp->LoadSource($innertext);
  36. if (!is_array($dtp->CTags)) {
  37. unset($dtp);
  38. return '';
  39. } else {
  40. $row['typelink'] = GetTypeUrl(
  41. $row['id'],
  42. MfTypedir($row['typedir']),
  43. $row['isdefault'],
  44. $row['defaultname'],
  45. $row['ispart'],
  46. $row['namerule2'],
  47. $row['siteurl'],
  48. $row['sitepath']
  49. );
  50. foreach ($dtp->CTags as $tagid => $ctag) {
  51. if (isset($row[$ctag->GetName()])) $dtp->Assign($tagid, $row[$ctag->GetName()]);
  52. }
  53. $revalue = $dtp->GetResult();
  54. unset($dtp);
  55. return $revalue;
  56. }
  57. }