/** @var array Cache for query results */
protected $_list = array();
/**
* @var array Customize list display
*
* align : determine value alignment
* prefix : displayed before value
* suffix : displayed after value
* image : object image
* icon : icon determined by values
* active : allow to toggle status
*/
protected $fields_list;
/** @var Smarty_Internal_Template|string */
protected $header_tpl = 'list_header.tpl';
/** @var Smarty_Internal_Template|string */
protected $content_tpl = 'list_content.tpl';
/** @var Smarty_Internal_Template|string */
protected $footer_tpl = 'list_footer.tpl';
/** @var array list of required actions for each list row */
public $actions = array();
====成员变量 end====
========构造器 start====
public function __construct()
{
$this->base_folder = 'helpers/list/';
$this->base_tpl = 'list.tpl';//列表布局模板{$header}{$content}{$footer}
parent::__construct();//$this->context = Context::getContext();
}
定义了列表助手的目录及模板
========构造器 end====
====generateList产生列表 start =========
Return an html list given the data to fill it up
// Append when we get a syntax error in SQL query
控制器的警告信息:内容,控制器名称
$this->context->controller->warnings[] = $this->l('Bad SQL query', 'Helper');
$this->tpl = $this->createTemplate($this->base_tpl);
return parent::generate();
这个方法代码如下:
/**
* default behaviour for helper is to return a tpl fetched
*
* @return string
*/
public function generate()
{
$this->tpl->assign($this->tpl_vars);
// ddd($this->tpl_vars);
//ddd($this->tpl);
return $this->tpl->fetch();
}
====generateList产生列表 end =========
转载于:https://my.oschina.net/u/2615982/blog/610069