#1 jkey418
下面是general.php文件,general 继承自 spControllerpublic function display($tplname, $output = TRUE)
{
if(FALSE == $output)
return parent::display($tplname, $output);
$this->tpl_header = $this->header();
$this->tpl_sidebar = $this->sidebar();
$this->tpl_footer = $this->footer();
parent::display($tplname, $output);
}
public function header()
{
return $this->display('general-header.html', FALSE);
}
public function sidebar()
{
return $this->display('general-footer.html', FALSE);
}
public function footer()
{
return $this->display('general-footer.html', FALSE);
}
下面是 main.php文件部分,main 类继承自 general
index(){
}
下面是 main-index.html 用于显示 index
<{$tpl_header}>
这里是内容
<{$tpl_sidebar}><{$tpl_footer}>
问题是:
打开浏览器测试时发现只有 $this->tpl_header 获得了赋值,而 $this->tpl_sidebar,$this->tpl_footer 没有得到返回值,而是直接输出了
最终显示结果为
siderbar()部分
footer()部分
header()部分
这里是内容
2010-08-24 14:20:52