Home  >  Article  >  Backend Development  >  关于thinkphp中的widget的开发解决思路

关于thinkphp中的widget的开发解决思路

WBOY
WBOYOriginal
2016-06-13 10:17:10840browse

关于thinkphp中的widget的开发
class HotkeyWidget extends Widget {
  public function render($data) {
$node=M('Hotkey');//这里是数据库表的实例化
$data=$node->limit('0,10')->select();
$data['list']=$data; 
$content = $this->renderFile ( ADDON_PATH . '/widgets/Hotkey.html', $data);
return $content;
}



我在Hotket.html中应该怎么调用HotkeyWidget 类中读取出来的数据? 如果应用到模版上面应该怎么调用?

------解决方案--------------------
会用thinkphp的,难道就不会用自定义的?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn