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='typeurl'/}" target="_self">{dede:field name='typename'/}</a> <ul> {dede:channel type='son' noself='yes'} <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='top'} <li><a href="{dede:field name='typeurl'/}" target="_self">{dede:field name='typename'/}</a> <ul class="flyout level2 child{dede:global name='itemindex'/}"> {dede:channel type='son' noself='yes'} <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='top'} {dede:php} $thisid = $refObj->Fields['id']; $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(',',$arr); if(!empty($str) && $i==1){ echo '<li><div><dl><dt><img src="/img/item_top.jpg" width="89" height="11"></dt>'; } echo '<dd><a href="/plus/list.php?tid='.$arr['id'].'">'.$arr['typename'].'</a></dd>'; } if(!empty($str)) echo '</dl></div>'; if(empty($str)){ echo '<li>'; } {/dede:php} <a href="{dede:field name='typeurl'/}" class='{dede:field.currentstyle/}'>{dede:field name='typename'/}</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!