演示链接:查看演示

dedecmsdedecms让likearticle的mytypeid支持多个栏目和子栏目

在使用dede:likearticle时,如果你想获取多个指定栏目下的相关文章,而刚好这个多个栏目下还有子栏目时,官方的程序不能满足你的需求,你需要改一下

 

打开 \\include\\taglib\\likearticle.lib.php 找到

 

<span style="font-family:tahoma,geneva,sans-serif;"><span style="font-size:14px;">if( !empty($typeid) && !preg_match('#,#', $typeid) ) {

$typeid = GetSonIds($typeid);

}</span></span>

 

在它下面加入

 

<span style="font-family:tahoma,geneva,sans-serif;"><span style="font-size:14px;">else

{

$typeids = explode(',', $typeid);

foreach($typeids as $ttid) {

$typeidss[] = GetSonIds($ttid);

}

$typeidStr = join(',', $typeidss);

$typeidss = explode(',', $typeidStr);

$typeidssok = array_unique($typeidss);

$typeid = join(',', $typeidssok);

}

 

</span></span>
 

THE END
喜欢就支持一下吧
点赞0 分享