dedecms调用指定栏目ID的tag标签。
打开文件:/include/taglib/tag.lib.php,找到:
$addsql = " WHERE typeid='$typeid' "; //大概在67行
修改为:
// 调用多栏目tag 鹏程木业网https://www.360muye.cn/
if( preg_match('#,#', $typeid) ) { $typeids = explode(',', $typeid); foreach($typeids as $ttid) { $typeidss[] = GetSonIds($ttid); } $typeidStr = join(',', $typeidss); $typeidss = explode(',', $typeidStr); $typeidssok = array_unique($typeidss); $typeid = join(',', $typeidssok); $addsql = " WHERE typeid IN ($typeid) "; } else { $addsql = " WHERE typeid IN (".GetSonIds($typeid).") "; }
在模板中调用代码:
{dede:tag row='30' sort='new' getall='1' typeid='1,2,3'} <a href="https://www.360muye.cn/ [field:link/]">[field:tag/]</a> {/dede:tag}
通过上面的代码,织梦dede就可以调用指定栏目ID的tag标签。转载请注明:鹏程木业网