Startpage >> Plog >> IncludeBlogtemplate

Include Blogtemplate

<< 中文字型修正 | Plog.HomePage | 修正一些 PHP 版本不同的錯誤 >>


在編輯模版時,加入 $blogtemplate 的變數

增加模版的通用性 by lss

使用方式

我們在樣版檔案中使用這樣的方式

 {include file="$blogtemplate/header.template"}

取代原來的

 {include file="grey/header.template"}

需要修改的檔案

修改class/dao/bloginfo.class.php
替 BlogInfo 類別增加getTemplate成員函式。這個成員函式會傳回目前blog使用的樣版名稱,我們要用來作為樣版中include敘述的目錄名稱。
在最後一個大括號前面加入下面的code:
function getTemplate()
{
     return $this->_settings->getValue("template");

}
修改的檔案是class/action/blogaction.class.php
在 setCommonData() 成員函式中加入下面的code:
$this->_view->setValue( 'blogtemplate', $this->_blogInfo->getTemplate());

<< 中文字型修正 | Plog.HomePage | 修正一些 PHP 版本不同的錯誤 >>

頁面最後更新於 2005 年 01 月 11 日,11:08 PM