转自 运营狗
typecho现有的输出所有分类
$this->widget('Widget_Metas_Category_List')
网上查到的相关代码,其中ignore表示要隐藏的分类mid
$this->widget('Widget_Metas_Category_List','ignore=1')
但通过上面的代码无法实现隐藏功能,查看系统文件,最后在/var/Widget/Metas/Category/Edit.php中看到了下面这段代码
/** 父级分类 */ $options = array(0 => _t('不选择')); $parents = $this->widget('Widget_Metas_Category_List@options', (isset($this->request->mid) ? 'ignore=' . $this->request->mid : '')); while ($parents->next()) { $options[$parents->mid] = str_repeat(' ', $parents->levels) . $parents->name; }
这代码看着很熟悉有木有,上面有个@options的字符串不知道是啥,毕竟PHP盲,尝试把@options加进去,KO,搞定!
最后的代码
<?php $this->widget('Widget_Metas_Category_List@options','ignore=1')->to($categories); ?>
在内页里面如何隐藏当前的分类呢。。。。【此处留下了没技术的泪水...
2018-11-20 下午10:06此时我也留下了无技术的眼泪
2018-11-20 下午11:58来转转
2018-05-17 下午4:02活抓大佬……
2018-05-17 下午4:03