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

77 lines
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 DedeBIZ.Taglib
  7. * @copyright Copyright (c) 2021, 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. $typeid = (!empty($refObj->TypeLink->TypeInfos['id']) ? $refObj->TypeLink->TypeInfos['id'] : 0);
  29. }
  30. if ($innertext == '') $innertext = GetSysTemplets('part_channelartlist.htm');
  31. $totalnum = $row;
  32. if (empty($totalnum)) $totalnum = 20;
  33. //获得类别ID总数的信息
  34. $typeids = array();
  35. if ($typeid == 0 || $typeid == 'top') {
  36. $tpsql = " reid=0 AND ispart<>2 AND ishidden<>1 AND channeltype>0 ";
  37. } else {
  38. if (!preg_match('#,#', $typeid)) {
  39. $tpsql = " reid='$typeid' AND ispart<>2 AND ishidden<>1 ";
  40. } else {
  41. $tpsql = " id IN($typeid) AND ispart<>2 AND ishidden<>1 ";
  42. }
  43. }
  44. $dsql->SetQuery("SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
  45. FROM `#@__arctype` WHERE $tpsql ORDER BY sortrank ASC LIMIT $totalnum");
  46. $dsql->Execute();
  47. while ($row = $dsql->GetArray()) {
  48. $typeids[] = $row;
  49. }
  50. if (!isset($typeids[0])) return '';
  51. $GLOBALS['itemindex'] = 0;
  52. $GLOBALS['itemparity'] = 1;
  53. for ($i = 0; isset($typeids[$i]); $i++) {
  54. $GLOBALS['itemindex']++;
  55. $pv = new PartView($typeids[$i]['id']);
  56. $pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);
  57. $pv->SetTemplet($innertext, 'string');
  58. $artlist .= $pv->GetResult();
  59. $GLOBALS['itemparity'] = ($GLOBALS['itemparity'] == 1 ? 2 : 1);
  60. }
  61. //注销环境变量,以防止后续调用中被使用
  62. $GLOBALS['envs']['typeid'] = $_sys_globals['typeid'];
  63. $GLOBALS['envs']['reid'] = '';
  64. if ($cacheid != '') {
  65. WriteCacheBlock($cacheid, $artlist);
  66. }
  67. return $artlist;
  68. }