首页 > CMS教程 > 其他CMS    日期:2018-08-26 / 来自互联网 / 浏览

{loop subcat(0,0,0,$siteid) $r}{/loop}

 获取子栏目:

@param $parentid 父级id
@param $type 栏目类型
@param $self 是否包含本身 0为不包含
@param $siteid 站点id

在PHPCMS中的函数定义代码如下:

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;
}

觉得上面的内容有用吗?快来点个赞吧!

点赞() 我要打赏

温馨提示 : 本站内容来自会员投稿以及互联网,所有源码及教程均为作者总结编辑,请大家在使用过程中提前做好备份,以免发生无法预知的错误,源码类教程请勿直接用于生产环境!

 可能感兴趣的文章

1 2 3 4 5