By default, Channel Column labels call top, son, and self. How can I obtain the names and links of cross columns?
In fact, you can change it in the original code. The following is the specific code. Open the file channel. Lib. php:
Search:
$topid = $refObj->TypeLink->TypeInfos[‘topid‘];
Add below:
$crossid = $refObj->TypeLink->TypeInfos[‘crossid‘];
Search again:
$topid = $row2[‘topid‘];
Add below:
$crossid = $row2[‘crossid‘];
Then look:
1 else if($type==‘son‘)2 {3 if($typeid==0) return ‘‘;4 $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath5 From `#@__arctype` WHERE reid=‘$typeid‘ And ishidden<>1 order by sortrank asc limit 0, $line ";6 }
Add below:
1 else if($type==‘cross‘)2 {3 if($typeid==0) return ‘‘;4 $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,crossid5 From `#@__arctype` WHERE id in ($crossid) And ishidden<>1 order by sortrank asc limit 0, $line ";6 }
After this modification, you can use it on the template.
The template code is:
1 {dede:channel type=‘cross‘}2 <a href=‘[field:typelink /]‘ title="[field:typename/]" >[field:typename/]</a> 3 {/dede:channel}
View code
In this way, you can use it.
Zhimeng dedecms expands the Channel Column label to obtain the cross column name and link