dedeHow to retrieve the third-level column name and the content list under the column?
The website divides the region into a province-city-article hierarchical structure according to needs. As the title says, how does dede retrieve the third-level column name and the content list under the column? The specific implementation is as follows, Interested friends can refer to the following
Recommended study: 梦Weavercms
The website divides the region into provinces-cities-articles hierarchical structure according to needs, column home page What needs to be displayed is
The code is as follows:
{dede:channelarclist} <!--省显示--> <a href="">省级标题:{dede:field name='name'/}</a> {dede:channel type='son'} <a href="">市级标题:[field:name/]</a> {dede:arclist} 该市文章{field:title/} {/dede:arclist} {/dede:channel} {/dede:channelarclist}
That is, the provincial columns are classified by cities and the article titles of each city are displayed. However, the {dede:channel} tag cannot be nested, so The {dede:arclist} tag will be output as it is. The solution:
The code is as follows:
$typeid = $row['id']; if((class_exists('PartView'))) { $pv = new PartView($typeid); $text = $likeType; $text= str_replace(array('{field', '/}'), array('[field', '/]'), $text); $pv->SetTemplet($text,'string'); $artlist = $pv->GetResult(); $likeType = $artlist; }
Find if($col>1) in /include/taglib/channel.lib.php $likeType .= "\r\n"; (v5.6 is 125 lines v5.7 is 156 lines) Add the above code to this sentence
The problem is solved.
Some people reported that after adding this code, the article page cannot be updated when it contains {dede:channel} {/dede:channel}, so you can look at the code and change it to this:
The code is as follows:
if($sanji) { $typeid = $row['id']; if((class_exists('PartView'))) { $pv = new PartView($typeid); $text = $likeType; $text= str_replace(array('{field', '/}'), array('[field', '/]'), $text); $pv->SetTemplet($text,'string'); $artlist = $pv->GetResult(); $likeType = $artlist; } }
Then add $sanji = $ctag->GetAtt('sanji'); after global $dsql; at the beginning of the channel.lib.php file
When called, it becomes:
The code is as follows:
{dede:channelartlist} {dede:field name='typeurl'/} {dede:field name='typename'/} //外框架 {dede:channel type='sun' sanji='1'}//子框架 <h3><a href="[field:typelink/]" target="_blank">[field:typename/]</a></h3> {dede:arclist row='5' titlelen='39'} //调用文章 连接: {field:arcurl/} 标题: {field:title/} {/dede:arclist} {/dede:channel} {/dede:channelartlist}
Problem solved.
The above is the detailed content of How does dede retrieve the third-level column name and the content list under the column?. For more information, please follow other related articles on the PHP Chinese website!