今天再看phpcms首页 index.html 的时候看到有一行这样的标签 {loop subcat(0,0,0,$siteid) $r} 这个在手册上没有找到就百度了下子。
subcat(): 获取子栏目的函数。 方法在 global.func.php 中。
/**
* 获取子栏目
* @param $parentid 父级id
* @param $type 栏目类型
* @param $self 是否包含本身 0为不包含
* @param $siteid 站点id
*/
function subcat($parentid = NULL, $type = NULL,$self = '0', $siteid = '') {
if (empty($siteid)) $siteid = get_siteid();
$category = getcache('category_content_'.$siteid,'commons');
foreach($category as $id=>$cat) {
if($cat['siteid'] == $siteid && ($parentid === NULL || $cat['parentid'] == $parentid) && ($type === NULL || $cat['type'] == $type)) $subcat[$id] = $cat;
if($self == 1 && $cat['catid'] == $parentid && !$cat['child']) $subcat[$id] = $cat;
}
return $subcat;
}
本文介绍了PHP CMS中用于获取子栏目的函数subcat()的使用方法及其实现原理。该函数通过传入参数来获取指定站点ID下的子栏目列表,并可以根据是否包含自身、父级ID及栏目类型进行过滤。
&spm=1001.2101.3001.5002&articleId=8955780&d=1&t=3&u=39a8924b4f014b1cb07000ed940578aa)
406

被折叠的 条评论
为什么被折叠?



