分类列表调用:
{foreach GetList(调用条数,分类ID) as $article} <li><span>{$article.Time('Y-m-d')}</span><a href="{$article.Url}">{$article.Title}</a></li> {/foreach}
站关键词、描述添加
{php} if($type=='index'){ $keywords = $zbp->option['ZC_BLOG_SUBNAME']; $description = $zbp->option['ZC_BLOG_COPYRIGHT']; }elseif($type=='category'){ $keywords = $category->Name; $description = $category->Intro; }elseif($type=='article'||$type=='page'){ $aryTags = array(); foreach($article->Tags as $key){ $aryTags[] = $key->Name; } if(count($aryTags)>0) $keywords = implode(',',$aryTags); $description = preg_replace('/[rns]+/', '', trim(SubStrUTF8(TransferHTML($article->Content,'[nohtml]'),100)).'...'); } {/php} {if isset($keywords)&&strlen($keywords)>0} <meta name="keywords" content="{$keywords}" /> {/if} {if isset($description)&&strlen($description)>0} <meta name="description" content="{$description}" /> {/if}
评论数判断
{if $article.CommNums==0} 暂无留言 {elseif $article.CommNums==1} 仅有1条留言 {else} 已有{$article.CommNums}条留言 {/if}
页面判断
{if $type=='index'&&$page=='1'} /*判断首页*/ {if $type=='category'} /*判断分类页*/ {if $type=='article'} /*判断日志页,不含独立页面,{if $article.Type==ZC_POST_TYPE_ARTICLE}(另一方案)*/ {if $type=='page'} /*判断独立页面*/ {if $type=='author'} /*判断用户页*/ {if $type=='date'} /*判断日期页*/ {if $type=='tag'} /*判断标签页*/
首页和分类列表页分离
在index.php文件里作判断,分离模板。比如:
{if $type=='index'} {template:index_default} {else} {template:index_list} {/if}
然后新建两个相应的模板文件:index_default.php和index_list.php
分页条
{$pagebar.PageBarCount} Pagebar长度 {$pagebar.PageCount} 每页显示文章数量 {$pagebar.PageAll} 总页码数 {$pagebar.PageNow} 当前页 {$pagebar.PageFirst} 首页 {$pagebar.PageLast} 尾页 {$pagebar.PagePrevious} 上一页 {$pagebar.PageNext} 下一页 <a href="{$pagebar.prevbutton}">« 之后的文章</a> <a href="{$pagebar.nextbutton}">更早的文章 »</a>