Posts Tagged ‘get_template_vars’

Smarty get_template_vars

10月 1st, 2007

今回初めて使った関数なので一応メモ

array get_template_vars ( [string varname])

パラメータが与えられない場合は、 全ての割り当てられた変数の配列を返します。

$content_block が無い場合デフォルトのテンプレートを使う

    public function append( $template = null , $path=null , $block='content' )
    {
        if (!$path){
            $path = $this->_param[controller];
        }
        if (!$template){
            $template = $this->_param[action];
        }
 
        $content = $this->_smarty->fetch($path.'/'.$template.'.tpl' ,md5(serialize($_GET)));
        $this->_smarty->append($block.'_block',$content);
    }
 
 
    public function showPage($base = "base")
    {
        if ( !$this->_smarty->get_template_vars('content_block') ){
            $this->append();
        }
        $this->_smarty->display($base.'.tpl');
    }