注意:本教程只在DedeCMS V5.6上测试过,v5.7sp1的话一般也会通用,请自行测试!
1. 修改include\taglib\infolink.lib.php,找到:
require_once(DEDEROOT.'/data/enums/infotype.php');
在其下面添加:
require_once(DEDEROOT.'/data/enums/自定义联动类别字段名.php');
function lib_infolink($ctag,$refObj)
{
global $dsql,$nativeplace,$infotype,$自定义联动类别字段 名,$hasSetEnumJs,$cfg_cmspath,$cfg_mainsite;
global $em_nativeplaces,$em_infotypes,$em_自定义联动类别字段名s; //看清楚,这里后面的个S
$fields = array('nativeplace'=>'','infotype'=>'','自定义联动类别字段名'=> '','typeid'=>$typeid, 'channelid'=>$channelid,'linkallplace'=>'','linkalltype'=> '','linkeall自定义联动类别字段名'=>'');
$fields['nativeplace'] = $fields['infotype'] = $fields['自定义联动类别字段名'] = '';
找到:
if(is_array($ctp->CTags))
在其下面添加:
折叠展开PHP 代码复制内容到剪贴板
$fields['linkalltype'] = "<a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}& amp;nativeplace={$nativeplace}'>不限</a>";
//下面添加一行
$fields['linkeall自定义联动类别字段名'] = "<a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}& amp;nativeplace={$nativeplace}'>不限</a>";
//自定义联动类别字段链接
if(emptyempty($自定义联动类别字段名))
{
foreach($em_自定义联动类别字段名s as $eid=>$em)
{
if($eid % 500 != 0) continue;
$fields['自定义联动类别字段名'] .= " <a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}& amp;自定义联动类别字段名={$eid}&nativeplace={$nativeplace}'>{$em}</a& gt;";
}
}