public function action_run( )
{
$this->getMeta( "ch_weibo_index" );
$var_array = array(
"page_title" => $this->metawrap['title'],
"page_description" => $this->metawrap['description'],
"page_keyword" => $this->metawrap['keyword']
);
$this->_tplfile = $this->getTPLFile( "weibo_index" );
TPL::assign( $var_array );
TPL::display( $this->_tplfile );
}
这个涵数后面三句$this->_tplfile = $this->getTPLFile( "weibo_index" );
TPL::assign( $var_array );
TPL::display( $this->_tplfile );是什么意思?谁能帮忙解释下吗?

解决方案 »

  1.   

    $this->_tplfile = $this->getTPLFile( "weibo_index" );调用getTPLFile方法将返回的值赋值给属性_tplfile
    _tplfile是当前类的一个属性名 getTPLFile是当前类或者其父类的一个方法
    TPL::assign( $var_array );和smarty差不多的就是一个将值传给页面
    TPL::display( $this->_tplfile );要显示的页面如果不清楚可以去看看TPL这个类 assign和display都在里面 虽然我没用过你这个框架 
      

  2.   

    $this->_tplfile = $this->getTPLFile( "weibo_index" );
    这个从函数名可知是获取模板文件的,echo $this->_tplfile; 不就知道了。
    TPL::assign( $var_array );  //这个类似smarty的assign,为模板分配变量
    TPL::display( $this->_tplfile );  //这个类似于smarty的display,显示模板
      

  3.   

    这个就是smarty模板,smarty模板手册中没讲到assign和display,哪里有相关资料?
      

  4.   

    Smarty中文手册,Smarty教程,Smarty模板的入门教材