- 修改文件:
/apps/home/controller/ParserController.php
- 添加代码:
php
$tags = implode(',', $rs); // 把栏目tags串起来
$tagsArrSum = array_count_values(explode(',', $tags)); // @mk-tags_one_sum 把所有tags组成数组并计算每个值得数量 - 添加新的判断:
php
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; - 前台使用:
html
{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}

