Home  >  Article  >  CMS Tutorial  >  How does dede retrieve the third-level column name and the content list under the column?

How does dede retrieve the third-level column name and the content list under the column?

藏色散人
藏色散人Original
2019-12-21 10:24:182426browse

How does dede retrieve the third-level column name and the content list under the column?

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=&#39;name&#39;/}</a> 
{dede:channel type=&#39;son&#39;} 
<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[&#39;id&#39;]; 
if((class_exists(&#39;PartView&#39;))) 
{ 
$pv = new PartView($typeid); 
$text = $likeType; 
$text= str_replace(array(&#39;{field&#39;, &#39;/}&#39;), array(&#39;[field&#39;, &#39;/]&#39;), $text); 
$pv->SetTemplet($text,&#39;string&#39;); 
$artlist = $pv->GetResult(); 
$likeType = $artlist; 
}

Find if($col>1) in /include/taglib/channel.lib.php $likeType .= "82e295699cff932a4d4dabba39074c35\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[&#39;id&#39;]; 
if((class_exists(&#39;PartView&#39;))) 
{ 
$pv = new PartView($typeid); 
$text = $likeType; 
$text= str_replace(array(&#39;{field&#39;, &#39;/}&#39;), array(&#39;[field&#39;, &#39;/]&#39;), $text); 
$pv->SetTemplet($text,&#39;string&#39;); 
$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=&#39;typeurl&#39;/} {dede:field name=&#39;typename&#39;/} //外框架 
{dede:channel type=&#39;sun&#39; sanji=&#39;1&#39;}//子框架 
<h3><a href="[field:typelink/]" target="_blank">[field:typename/]</a></h3> 
{dede:arclist row=&#39;5&#39; titlelen=&#39;39&#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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn