国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

108 行
3.7KB

  1. <?php
  2. if(!defined('DEDEINC')) exit('Request Error!');
  3. require_once(DEDEINC.'/channelunit.func.php');
  4. /**
  5. * 动态模板channel标签
  6. *
  7. * @version $Id: plus_ask.php 1 13:58 2010年7月5日Z tianya $
  8. * @package DedeCMS.Tpllib
  9. * @copyright Copyright (c) 2020, DedeBIZ.COM
  10. * @license https://www.dedebiz.com/license
  11. * @link https://www.dedebiz.com
  12. */
  13. function plus_channel(&$atts, &$refObj, &$fields)
  14. {
  15. global $dsql,$_vars;
  16. $attlist = "typeid=0,reid=0,row=100,type=son,currentstyle=";
  17. FillAtts($atts,$attlist);
  18. FillFields($atts,$fields,$refObj);
  19. extract($atts, EXTR_OVERWRITE);
  20. $line = empty($row) ? 100 : $row;
  21. $reArray = array();
  22. $reid = 0;
  23. $topid = 0;
  24. //如果属性里没指定栏目id,从引用类里获取栏目信息
  25. if(empty($typeid))
  26. {
  27. if( isset($refObj->TypeLink->TypeInfos['id']) )
  28. {
  29. $typeid = $refObj->TypeLink->TypeInfos['id'];
  30. $reid = $refObj->TypeLink->TypeInfos['reid'];
  31. $topid = $refObj->TypeLink->TypeInfos['topid'];
  32. }
  33. else {
  34. $typeid = 0;
  35. }
  36. }
  37. //如果指定了栏目id,从数据库获取栏目信息
  38. else
  39. {
  40. $row2 = $dsql->GetOne("SELECT * FROM `#@__arctype` WHERE id='$typeid' ");
  41. $typeid = $row2['id'];
  42. $reid = $row2['reid'];
  43. $topid = $row2['topid'];
  44. $issetInfos = true;
  45. }
  46. if($type=='' || $type=='sun') $type='son';
  47. if($type=='top')
  48. {
  49. $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
  50. FROM `#@__arctype` WHERE reid=0 AND ishidden<>1 ORDER BY sortrank ASC LIMIT 0, $line ";
  51. }
  52. else if($type=='son')
  53. {
  54. if($typeid==0) return $reArray;
  55. $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
  56. FROM `#@__arctype` WHERE reid='$typeid' AND ishidden<>1 ORDER BY sortrank ASC LIMIT 0, $line ";
  57. }
  58. else if($type=='self')
  59. {
  60. if($reid==0) return $reArray;
  61. $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
  62. FROM `#@__arctype` WHERE reid='$reid' AND ishidden<>1 ORDER BY sortrank ASC LIMIT 0, $line ";
  63. }
  64. //检查是否有子栏目,并返回rel提示(用于二级菜单)
  65. $needRel = true;
  66. if(empty($sql)) return $reArray;
  67. $dsql->Execute('me',$sql);
  68. $totalRow = $dsql->GetTotalRow('me');
  69. //如果用子栏目模式,当没有子栏目时显示同级栏目
  70. if($type=='son' && $reid!=0 && $totalRow==0)
  71. {
  72. $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
  73. FROM `#@__arctype` WHERE reid='$reid' AND ishidden<>1 ORDER BY sortrank ASC LIMIT 0, $line ";
  74. $dsql->Execute('me', $sql);
  75. }
  76. $GLOBALS['autoindex'] = 0;
  77. while($row=$dsql->GetArray())
  78. {
  79. $row['currentstyle'] = $row['sonids'] = $row['rel'] = '';
  80. if($needRel)
  81. {
  82. $row['sonids'] = GetSonIds($row['id'], 0, false);
  83. if($row['sonids']=='') $row['rel'] = '';
  84. else $row['rel'] = " rel='dropmenu{$row['id']}'";
  85. }
  86. //处理同级栏目中,当前栏目的样式
  87. if( ($row['id']==$typeid || ($topid==$row['id'] && $type=='top') ) && $currentstyle!='' )
  88. {
  89. $row['currentstyle'] = $currentstyle;
  90. }
  91. $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);
  92. $reArray[] = $row;
  93. $GLOBALS['autoindex']++;
  94. }
  95. //Loop for $i
  96. $dsql->FreeResult();
  97. return $reArray;
  98. }