PbootCMS增加同tag标签文章数量显示
教程步骤
打开修改文件:/apps/home/controller/ParserController.php
1、找到这段代码(有两处),在下方添加新代码
$tags = implode(‘,’, $rs); // 把栏目tags串起来
添加后
$tags = implode(‘,’, $rs); // 把栏目tags串起来$tagsArrSum = array_count_values(explode(‘,’, $tags)); // @mk-tags_one_sum 把所有tags组成数组并计算每个值得数量
2、找到这段代码在下方位置,添加新的判断,具体位置看截图
case ‘text’:$one_html = str_replace($matches2[0][$j], $this->adjustLabelData($params, $value[‘tags’]), $one_html);break;
添加后
case ‘text’:$one_html = str_replace($matches2[0][$j], $this->adjustLabelData($params, $value[‘tags’]), $one_html);break;case ‘sum’:$sum = $tagsArrSum[$value[‘tags’]]; // @mk-tags_one_sum$one_html = str_replace($matches2[0][$j], $sum, $one_html);break;
3、上面修改后,前台就读了个sum标签,具体使用如下
{pboot:tags scode=6 target=tag}<li><a href=”[tags:link]”><p title=”[tags:text]”>[tags:text]</p><font><span>([tags:sum])</span></font></a></li>{/pboot:tags}