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

105 lines
3.4KB

  1. <?php if(!defined('DEDEINC')) exit('Request Error!');
  2. /**
  3. * 获取当前频道的下级栏目的内容列表标签
  4. *
  5. * @version $Id: channelartlist.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/v6
  9. * @link https://www.dedebiz.com
  10. */
  11. /*>>dede>>
  12. <name>频道文档</name>
  13. <type>全局标记</type>
  14. <for>V55,V56,V57</for>
  15. <description>获取当前频道的下级栏目的内容列表标签</description>
  16. <demo>
  17. {dede:channelartlist row=6}
  18. <dl>
  19. <dt><a href='{dede:field name='typeurl'/}'>{dede:field name='typename'/}</a></dt>
  20. <dd>
  21. {dede:arclist titlelen='42' row='10'} <ul class='autod'>
  22. <li><a href="[field:arcurl /]">[field:title /]</a></li>
  23. <li>([field:pubdate function="MyDate('m-d',@me)"/])</li>
  24. </ul>
  25. {/dede:arclist}
  26. </dl>
  27. {/dede:channelartlist}
  28. </demo>
  29. <attributes>
  30. <iterm>typeid:频道ID</iterm>
  31. <iterm>row:获取的栏目返回值</iterm>
  32. </attributes>
  33. >>dede>>*/
  34. require_once(DEDEINC.'/arc.partview.class.php');
  35. function lib_channelartlist(&$ctag,&$refObj)
  36. {
  37. global $dsql,$envs,$_sys_globals;
  38. //处理标记属性、innertext
  39. $attlist = 'typeid|0,row|20,cacheid|';
  40. FillAttsDefault($ctag->CAttribute->Items,$attlist);
  41. extract($ctag->CAttribute->Items, EXTR_SKIP);
  42. $innertext = trim($ctag->GetInnerText());
  43. $artlist = '';
  44. //读取固定的缓存块
  45. $cacheid = trim($cacheid);
  46. if($cacheid !='') {
  47. $artlist = GetCacheBlock($cacheid);
  48. if($artlist!='') return $artlist;
  49. }
  50. if(empty($typeid))
  51. {
  52. $typeid = ( !empty($refObj->TypeLink->TypeInfos['id']) ? $refObj->TypeLink->TypeInfos['id'] : 0 );
  53. }
  54. if($innertext=='') $innertext = GetSysTemplets('part_channelartlist.htm');
  55. $totalnum = $row;
  56. if(empty($totalnum)) $totalnum = 20;
  57. //获得类别ID总数的信息
  58. $typeids = array();
  59. if($typeid==0 || $typeid=='top') {
  60. $tpsql = " reid=0 AND ispart<>2 AND ishidden<>1 AND channeltype>0 ";
  61. }
  62. else
  63. {
  64. if(!preg_match('#,#', $typeid)) {
  65. $tpsql = " reid='$typeid' AND ispart<>2 AND ishidden<>1 ";
  66. }
  67. else {
  68. $tpsql = " id IN($typeid) AND ispart<>2 AND ishidden<>1 ";
  69. }
  70. }
  71. $dsql->SetQuery("SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
  72. FROM `#@__arctype` WHERE $tpsql ORDER BY sortrank ASC LIMIT $totalnum");
  73. $dsql->Execute();
  74. while($row = $dsql->GetArray()) {
  75. $typeids[] = $row;
  76. }
  77. if(!isset($typeids[0])) return '';
  78. $GLOBALS['itemindex'] = 0;
  79. $GLOBALS['itemparity'] = 1;
  80. for($i=0;isset($typeids[$i]);$i++)
  81. {
  82. $GLOBALS['itemindex']++;
  83. $pv = new PartView($typeids[$i]['id']);
  84. $pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);
  85. $pv->SetTemplet($innertext,'string');
  86. $artlist .= $pv->GetResult();
  87. $GLOBALS['itemparity'] = ($GLOBALS['itemparity']==1 ? 2 : 1);
  88. }
  89. //注销环境变量,以防止后续调用中被使用
  90. $GLOBALS['envs']['typeid'] = $_sys_globals['typeid'];
  91. $GLOBALS['envs']['reid'] = '';
  92. if($cacheid !='') {
  93. WriteCacheBlock($cacheid, $artlist);
  94. }
  95. return $artlist;
  96. }