关于display问题

#1 jkey418

下面是general.php文件,general 继承自 spController
public 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()部分
这里是内容
我想应该是 display 的问题,但是不知如何解决?

2010-08-24 14:20:52

#2 jake

我刚才测试过了,这个是框架内部的一个逻辑处理问题(有些怪,呵呵)

你可以这样,在spController的101行的if前面加入@ob_start();,就可以了。

另外,SVN同时更新这个问题。

2010-08-24 15:54:04

#3 jkey418

感谢,终于可以正常输出了

2010-08-24 16:04:11