index.php,這個頁面會在多處用到。 比如首頁、列表頁、標簽頁、用戶頁等等與列表有關系的所有頁面。
# 經常要用到的模板:
頭部文件:
~~~
{template:header}
~~~
菜單導航:
~~~
{module:navbar}
~~~
分頁文件:
~~~
{template:pagebar}
~~~
側邊模塊調用
~~~
{template:sidebar}
~~~
尾部文件:
~~~
{template:footer}
~~~
獲取文章列表:
~~~
{foreach $articles as $article}
{if $article.IsTop}
{template:post-istop} //置頂文章樣式
{else}
{template:post-multi} //普通文章樣式
{/if}
{/foreach}
~~~
# 常用標簽
{$type}:頁面屬性,比如(首頁、列表頁、標簽頁、用戶頁)
{$subname}:博客副標題
# 頁面分離,頁面判斷:
~~~
{if $type=='index'&&$page=='1'} /*判斷首頁*/
~~~
很多用戶在制作主體的時候,希望首頁、列表頁、標簽頁、用戶頁等顯示的頁面均不相同了,這個時候就需要用到頁面判斷,在index.php頁面清空,然后直接寫判斷語句,例如判斷首頁{if $type=='index'&&$page=='1'},當頁面是首頁的時候{template:index_index},調用index_index.php。當然index_index.php文件時需要在模板下面創建的。
- ZBP介紹
- Z-Blog PHP介紹
- 使用協議
- 程序入門
- 環境要求
- 目錄結構
- 安裝指南
- 安裝
- 搬家教程
- 模版結構
- 主題文件構造
- header.php
- index.php
- 404.php
- comment.php
- commentpost.php
- comments.php
- footer.php
- post-istop.php
- post-multi.php
- post-page.php
- post-single.php
- single.php
- include.php
- 模版制作
- 前言
- 主題文件結構
- HTML靜態模板制作
- 開始制作模板
- 制作頭部文件
- 制作底部文件
- 制作文章列表
- 制作文章頁面
- 說明
- 常見問題
- 文章添加新的字段
- 網站分類加文章總數
- 錯誤大全