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

82 lines
3.2KB

  1. <?php
  2. if (!defined('DEDEINC')) exit('dedebiz');
  3. /**
  4. * 获取当前栏目的下级栏目的文档列表标签
  5. *
  6. * @version $id:channelartlist.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. require_once(DEDEINC.'/archive/partview.class.php');
  13. function lib_channelartlist(&$ctag, &$refObj)
  14. {
  15. global $dsql, $envs, $_sys_globals;
  16. //添加不调用指定栏目文档参数,语法 notypeid='1'
  17. $attlist = 'typeid|0,row|20,cacheid|,notypeid|0';
  18. FillAttsDefault($ctag->CAttribute->Items, $attlist);
  19. extract($ctag->CAttribute->Items, EXTR_SKIP);
  20. $innertext = trim($ctag->GetInnerText());
  21. $artlist = '';
  22. //读取固定的缓存块
  23. $cacheid = trim($cacheid);
  24. if ($cacheid != '') {
  25. $artlist = GetCacheBlock($cacheid);
  26. if ($artlist != '') return $artlist;
  27. }
  28. if (empty($typeid)) {
  29. $typeid = (!empty($refObj->TypeLink->TypeInfos['id']) ? $refObj->TypeLink->TypeInfos['id'] : 0);
  30. }
  31. if ($innertext == '') $innertext = GetSysTemplets('part_channelartlist.htm');
  32. $totalnum = $row;
  33. if (empty($totalnum)) $totalnum = 20;
  34. //获得类别id总数的信息
  35. $typeids = array();
  36. if ($typeid==0 || $typeid=='top') {
  37. $tpsql = " reid=0 AND channeltype>0 AND ishidden<>1 ";
  38. } else {
  39. if (!preg_match('#,#', $typeid)) {
  40. $tpsql = " reid='$typeid' AND ishidden<>1 ";
  41. } else {
  42. $tpsql = " id IN($typeid) AND ishidden<>1 ";
  43. }
  44. }
  45. //否定指定栏目
  46. if ($notypeid!=0) {
  47. $tpsql = $tpsql."and not(id in($notypeid))";
  48. }
  49. $dsql->SetQuery("SELECT * FROM `#@__arctype` WHERE $tpsql ORDER BY sortrank ASC LIMIT $totalnum");
  50. $dsql->Execute();
  51. while ($row = $dsql->GetArray()) {
  52. $typeids[] = $row;
  53. }
  54. if (!isset($typeids[0])) return '';
  55. $GLOBALS['itemindex'] = 0;
  56. $GLOBALS['itemparity'] = 1;
  57. for ($i = 0; isset($typeids[$i]); $i++) {
  58. $GLOBALS['itemindex']++;
  59. $pv = new PartView($typeids[$i]['id']);
  60. $pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);
  61. //栏目高亮
  62. if (isset($refObj->TypeLink->TypeInfos)) {
  63. if ($typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['id'] || $typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['reid'] || $typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['topid'] || $typeids[$i]['id'] == GetTopid($refObj->TypeLink->TypeInfos['id']) )
  64. {
  65. $pv->Fields['currentstyle'] = $currentstyle ? $currentstyle : 'current';
  66. } else {
  67. $pv->Fields['currentstyle'] = '';
  68. }
  69. }
  70. $pv->SetTemplet($innertext,'string');
  71. $artlist .= $pv->GetResult();
  72. $GLOBALS['itemparity'] = ($GLOBALS['itemparity'] == 1 ? 2 : 1);
  73. }
  74. //注销环境变量,以防止后续调用中被使用
  75. $GLOBALS['envs']['typeid'] = $_sys_globals['typeid'];
  76. $GLOBALS['envs']['reid'] = '';
  77. if ($cacheid != '') {
  78. WriteCacheBlock($cacheid, $artlist);
  79. }
  80. return $artlist;
  81. }
  82. ?>