在ZBLOG主题开发中,我们首先要做的就是在template/index.php中举行页面的推断,即,推断当页面为首页时要挪用哪一个模板文件,为分类页、标签页、文章页、自力页面和日期页时各要挪用哪一个页面模板,以至更细致的是哪一个分类要挪用哪一个模板文件!
要想完成这一功用,我们就要学会推断页面的type属性,完成这一目标详细代码以下:
{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'&&$page=='1'} {template:post-index}{else}{template:post-list}{/if}然后新建两个响应的模板文件:post-index.php(原index.php更名即可)和post-list.php(原index.php复制并更名即可)
个中post-index.php为首页,post-list.php为除了首页以外的其他文章列表页。

评论列表