今天搞了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代替。

相关文章:

  • 2021-04-25
  • 2022-12-23
  • 2021-05-01
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
  • 2021-07-21
  • 2022-01-27
猜你喜欢
  • 2021-08-10
  • 2022-12-23
  • 2022-12-23
  • 2021-08-09
  • 2022-12-23
  • 2021-04-02
  • 2021-06-12
相关资源
相似解决方案