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

81 line
2.7KB

  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
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(DEDEINC.'/arc.partview.class.php');
  12. function lib_channelartlist(&$ctag,&$refObj)
  13. {
  14. global $dsql,$envs,$_sys_globals;
  15. //处理标记属性、innertext
  16. $attlist = 'typeid|0,row|20,cacheid|';
  17. FillAttsDefault($ctag->CAttribute->Items,$attlist);
  18. extract($ctag->CAttribute->Items, EXTR_SKIP);
  19. $innertext = trim($ctag->GetInnerText());
  20. $artlist = '';
  21. //读取固定的缓存块
  22. $cacheid = trim($cacheid);
  23. if($cacheid !='') {
  24. $artlist = GetCacheBlock($cacheid);
  25. if($artlist!='') return $artlist;
  26. }
  27. if(empty($typeid))
  28. {
  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 ispart<>2 AND ishidden<>1 AND channeltype>0 ";
  38. }
  39. else
  40. {
  41. if(!preg_match('#,#', $typeid)) {
  42. $tpsql = " reid='$typeid' AND ispart<>2 AND ishidden<>1 ";
  43. }
  44. else {
  45. $tpsql = " id IN($typeid) AND ispart<>2 AND ishidden<>1 ";
  46. }
  47. }
  48. $dsql->SetQuery("SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
  49. 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. {
  59. $GLOBALS['itemindex']++;
  60. $pv = new PartView($typeids[$i]['id']);
  61. $pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);
  62. $pv->SetTemplet($innertext,'string');
  63. $artlist .= $pv->GetResult();
  64. $GLOBALS['itemparity'] = ($GLOBALS['itemparity']==1 ? 2 : 1);
  65. }
  66. //注销环境变量,以防止后续调用中被使用
  67. $GLOBALS['envs']['typeid'] = $_sys_globals['typeid'];
  68. $GLOBALS['envs']['reid'] = '';
  69. if($cacheid !='') {
  70. WriteCacheBlock($cacheid, $artlist);
  71. }
  72. return $artlist;
  73. }