class Theme
{
function __construct()
{
}
function load($folder, $file)
{
$theme_path = ROOTPATH . '/theme/' . $folder . '/' . $file . '.php';
require_once($theme_path);
return TRUE;
}
}
上的index.phpPHP新手類
<?php
require class.theme.php
$theme = new Theme;
$theme->load('site','index');
?>
在我的網站/ index.php文件
<?php
// to work i need another $theme = new theme; why can i do this ? can i make
it make it work twice or more inside the function load ?
$theme->load('site','header');
$theme->load('site','footer');
?>
不知它需要$主題=新的主題;再次在網站/ index.php
是否有另一種方式使其工作?也許我的班級設計不好,或算法失敗。
編輯*更多信息 好吧,所以我試圖做的是加載頁眉查看頁腳視圖。
我不明白你的問題是什麼或不起作用? – 2010-08-17 12:27:25