phpcms v9 tags标签列表页调用文章所属栏目名称及url链接的方法
本文为CMS集中营()站长为您总结的phpcms v9 tags标签列表页调用文章所属栏目名称及url链接的方法,希望本文能帮您解决疑问。
1、打开 \phpcms\modules\content\tag.php 文件
找到(约48行)
$res = $this->db->get_one(array('id'=>$contentid), 'title, description, url, inputtime, style');
修改为
$res = $this->db->get_one(array('id'=>$contentid), 'title, catid, description, url, inputtime, style');
2、在tag_list.html模版调用栏目名称及url链接之前加入如下代码:
<?php $CATEGORYS = getcache('category_content_1','commons');?>
加入此代码的目的为引用缓存
添加代码后就可以使用{$CATEGORYS[$r[catid]][catname]}调用栏目名称及{$CATEGORYS[$r[catid]][url]}调用栏目url链接了
1、打开 \phpcms\modules\content\tag.php 文件
找到(约48行)
$res = $this->db->get_one(array('id'=>$contentid), 'title, description, url, inputtime, style');
修改为
$res = $this->db->get_one(array('id'=>$contentid), 'title, catid, description, url, inputtime, style');
2、在tag_list.html模版调用栏目名称及url链接之前加入如下代码:
<?php $CATEGORYS = getcache('category_content_1','commons');?>
加入此代码的目的为引用缓存
添加代码后就可以使用{$CATEGORYS[$r[catid]][catname]}调用栏目名称及{$CATEGORYS[$r[catid]][url]}调用栏目url链接了