[模板] 内容列表模板范例
{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="/">网站首页</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> <!--管理员登陆后发布文章按钮--> {nocache} {if $_Y['self']} <a href="{$_Y['basescript']}.php?mod=add&catid={$cat['catid']}">添加内容</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“ 为专为派生而存在的通用命名类,未免样式冲突,此类类名不应该单独赋予样式,只能做派生定义。
2、本例样式的是变量的使用,没有对代码结构有要求