[模板] 內(nèi)容列表模板范例
{include file=$_Y['template']['header']} <div class="cl"> <!--左邊欄導航--> <div class="left"> <div>{$cat['title']}<span>{$cat['subtitle']}</span></div> <ul> {if $cat['sub']} {foreach $cat['sub'] as $v} <li {if $cat['catid'] == $v}class="a"{/if}><a href="{$_Y['basescript']}-list-{$v}-1.html">{$cats[$v]['title']}</a></li> {/foreach} {elseif $cat['other']} {foreach $cat['other'] as $v} <li {if $cat['catid'] == $v}class="a"{/if}><a href="{$_Y['basescript']}-list-{$v}-1.html">{$cats[$v]['title']}</a></li> {/foreach} {/if} </ul> </div> <div class="right"> <div class="page_box"> <!--面包削導航--> <p> 當前位置:<a href="/">網(wǎng)站首頁</a> > {foreach $cat['path'] as $v} <a href="{$_Y['basescript']}-list-{$v}-1.html">{$cats[$v]['title']}</a> > {/foreach} <a href="{$_Y['basescript']}-list-{$cat['catid']}-1.html">{$cat['title']}</a> </p> <!--當前欄目標題--> <h3>{$cat['title']}<span>{$cat['subtitle']}</span></h3> <!--管理員登陸后發(fā)布文章按鈕--> {nocache} {if $_Y['self']} <a href="{$_Y['basescript']}.php?mod=add&catid={$cat['catid']}">添加內(nèi)容</a> {/if} {/nocache} <!--文章列表--> <ul> {foreach $list as $v} <li> <a href="{$_Y['basescript']}-article-{$v['aid']}.html" target="_blank" class="cover"> <img src="{$v['pic']}@220w_120h_1e_1c.jpg" width="246" height="136" alt="{$v['title']}" /> </a> <div> <a href="{$_Y['basescript']}-article-{$v['aid']}.html" target="_blank" class="title">{$v['title']}</a> <p class="info"> <span class="cat"><a href="{$_Y['basescript']}-list-{$v['catid']}-1.html">{$cats[$v['catid']]['title']}</a></span> <span class="date">{date style="Y年m月d日" time=$v['dateline']}</span><span class="views">瀏覽量:{$v['views']}</span> </p> <p class="summary">{$v['summary']}</p> </div> </li> {/foreach} </ul> <!--分頁代碼--> {$pagehtml} </div> </div> </div> {include file=$_Y['template']['footer']}
說明:
1、次例中文章列表中的類“info”、“cover”、“title”、“info”、“summary”、“date”、“views“ 為專為派生而存在的通用命名類,未免樣式?jīng)_突,此類類名不應該單獨賦予樣式,只能做派生定義。
2、本例樣式的是變量的使用,沒有對代碼結(jié)構(gòu)有要求