Home >CMS Tutorial >DEDECMS >How to call the top-level columns and the secondary columns below in DreamWeaver

How to call the top-level columns and the secondary columns below in DreamWeaver

藏色散人
藏色散人Original
2020-01-07 09:25:172598browse

How to call the top-level columns and the secondary columns below in DreamWeaver

How does Dreamweaver call the top-level column and the secondary columns below?

Dreamweaver calls the top-level column and the following Second-level columns

Recommended learning: 梦Weavercms

Sometimes it is necessary to call the top-level columns and the secondary columns below, such as when making a drop-down menu. The simplest way to call the secondary column:

{dede:channelartlist typeid='top'}
<li><a href="{dede:field name=&#39;typeurl&#39;/}" target="_self">{dede:field name=&#39;typename&#39;/}</a>
<ul>
{dede:channel type=&#39;son&#39; noself=&#39;yes&#39;}
<li><a href="[field:typelink/]" target="_self">[field:typename/]</a></li>
{/dede:channel}
</ul>
</li>
{/dede:channelartlist}

Sometimes when you need to make styles, you need to add different css to a certain tag in dede:channelartlist, such as the following example:

{dede:channelartlist typeid=&#39;top&#39;}
<li><a href="{dede:field name=&#39;typeurl&#39;/}" target="_self">{dede:field name=&#39;typename&#39;/}</a>
<ul class="flyout level2 child{dede:global name=&#39;itemindex&#39;/}">
{dede:channel type=&#39;son&#39; noself=&#39;yes&#39;}
<li><a href="[field:typelink/]" target="_self">[field:typename/]</a></li>
{/dede:channel}
</ul>
</li>
{/dede:channelartlist}

{dede:global name='itemindex'/} is automatically incremented every time the top column is called.

For a more complex way to call the secondary column, use the dede:php tag, as in the following example:

<ul>
<li><a href="{dede:global.cfg_basehost/}">网站首页</a></li>
{dede:channelartlist typeid=&#39;top&#39;}
{dede:php}
$thisid = $refObj->Fields[&#39;id&#39;];
$dsql->SetQuery("Select * from `dede_arctype` where reid=".$thisid." ORDER BY sortrank");
$dsql->Execute();
$i=0;
while($arr = $dsql->getArray()){
$i = $i +1;
$str = implode(&#39;,&#39;,$arr);
if(!empty($str) && $i==1){
 echo &#39;<li><div><dl><dt><img src="/img/item_top.jpg" width="89" height="11"></dt>&#39;; 
}
echo &#39;<dd><a href="/plus/list.php?tid=&#39;.$arr[&#39;id&#39;].&#39;">&#39;.$arr[&#39;typename&#39;].&#39;</a></dd>&#39;;
}
if(!empty($str)) echo &#39;</dl></div>&#39;;
if(empty($str)){
 echo &#39;<li>&#39;;
}
{/dede:php}
<a href="{dede:field name=&#39;typeurl&#39;/}" class=&#39;{dede:field.currentstyle/}&#39;>{dede:field name=&#39;typename&#39;/}</a>
 </li>
{/dede:channelartlist}
</ul>

Although this method is more complex, it is also more flexible.

The above is the detailed content of How to call the top-level columns and the secondary columns below in DreamWeaver. 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