Home > CMS Tutorial > DEDECMS > body text

How does dedecms determine that the secondary column is empty and not displayed?

藏色散人
Release: 2019-12-14 09:54:45
Original
2435 people have browsed it

How does dedecms determine that the secondary column is empty and not displayed?

dedecmsHow to determine whether the secondary column is empty and not displayed?

When developing a website with dedecms, if you need to call a secondary column, just use the channelartlist tag. However, if there is no secondary column under this column, an empty DIV will be generated. I tried running PHP to judge the default label, but it was not concise enough. The following is the simplest implementation method.

Recommended study: 梦Weavercms

The latest version of DedeCMS prohibits the running of template PHP. Backend → System → Basic System Parameters → Other Options → The default template engine is disabled Tag, just remove php.

{dede:channelartlist typeid='top'}
<li><a href="{dede:field name=&#39;typeurl&#39;/}">{dede:field name=&#39;typename&#39;/}</a>
{dede:php}
$id = $refObj->Fields[&#39;id&#39;];
$sql = ("SELECT * FROM dede_arctype where reid =&#39;$id&#39;");
$db->SetQuery($sql);
$db->Execute();
if($db->GetTotalRow()){
echo &#39;<ul>&#39;;
while($row = $db->GetArray()){
$url = str_replace(&#39;{cmspath}&#39;,&#39;&#39;,($row[typedir]));
echo "<li><a href=".$url.">".($row[typename])."</a></li>";
};
echo &#39;</ul>&#39;;
};
{/dede:php}
</li>
{/dede:channelartlist}
Copy after login

The above is the detailed content of How does dedecms determine that the secondary column is empty and not displayed?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!