码迷,mamicode.com
首页 > Web开发 > 详细

thinkphp3.1.3中widget用法

时间:2014-11-10 11:32:42      阅读:338      评论:0      收藏:0      [点我收藏+]

标签:style   blog   io   color   sp   文件   div   on   问题   

今天搞了tp3.1的widget,继承了widget类,但是老是掉用错误,所以换种写法,直接继承action

TestAction.class.php

1 $this->display();//调用模板
2 
3 Group/Home/Widget/TestWidget.class.php
4 
5 class TestWidget extends Action{
6 public function hello($name=”){
7 echo (“hello,”.$name.”!”);
8 }
9 }

 

在模板文件中,调用该挂件

<?php

A(‘Test’,‘Widget’)->hello(‘world’);

?>

 

搞不懂手册上的{:W(‘Cate/Menu‘)},没有显示。所以琢磨了以上做法。R方法感觉也有点问题,所以用A代替。

thinkphp3.1.3中widget用法

标签:style   blog   io   color   sp   文件   div   on   问题   

原文地址:http://www.cnblogs.com/findgor/p/4086529.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!