我们知道,首页要调用出所有栏目的标题和文章可以用下面的标签
{loop subcat(0,0,0,$siteid) $r}
{php $num++}
<div class="box left">
<div class="title"><span class="right"><a href="{$r[url]}">更多>></a></span>{$r[catname]}</div>
<ul class="clearfix">
{pc:content action="lists" catid="$r[catid]" num="5" order="inputtime DESC" siteid="$siteid"}
{loop $data $v}
<li>·<a href="{$v['url']}" target="_blank" title="{$v['title']}">{str_cut($v['title'],100)}</a></li>
{/loop}
{/pc}
</ul>
</div>
{/loop}
如果你有某个栏目不想出现的话,可以加上
{php if($r['catid']==36) continue;}
同理,如果你有某些栏目不想出现的话,可以加上
{php if($r['catid']==36||$r['catid']==23||$r['catid']==45||$r['catid']==81) continue;}
完整标签如下(ID为36的栏目不出现)
{loop subcat(0,0,0,$siteid) $r}
{php $num++}
{php if($r['catid']==36) continue;}
<div class="box left">
<div class="title"><span class="right"><a href="{$r[url]}">更多>></a></span>{$r[catname]}</div>
<ul class="clearfix">
{pc:content action="lists" catid="$r[catid]" num="5" order="inputtime DESC" siteid="$siteid"}
{loop $data $v}
<li>·<a href="{$v['url']}" target="_blank" title="{$v['title']}">{str_cut($v['title'],100)}</a></li>
{/loop}
{/pc}
</ul>
</div>
{/loop}
如果你想循环到某个栏目就终止循环,就加上
{php if($r['catid']==36) break;}
小提示:如果你实现栏目间能隔开一点距离,可以用{$num}进行判断
{loop subcat(0,0,0,$siteid) $r}
{php $num++}
<div class="box left"{if $num%2!=0} style="margin-left:20px; margin-right:20px;"{/if}>
<div class="title"><span class="right"><a href="{$r[url]}">更多>></a></span>{$r[catname]}</div>
<ul class="clearfix">
{pc:content action="lists" catid="$r[catid]" num="5" order="inputtime DESC" siteid="$siteid"}
{loop $data $v}
<li>·<a href="{$v['url']}" target="_blank" title="{$v['title']}">{str_cut($v['title'],100)}</a></li>
{/loop}
{/pc}
</ul>
</div>
{/loop}