search
HomeCMS TutorialDEDECMSHow 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?

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 .= "\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 id="a-nbsp-href-field-typelink-nbsp-target-blank-field-typename-a"><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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.