近期在看YIIpublic $template='{view} {update} {delete}';
以上这种写法,如何单独输出{view},{update}呢
同时以下代码片段还会报错foreach(array('view','update','delete') as $id)
{
$button=array(
'label'=>$this->{$id.'ButtonLabel'},
'url'=>$this->{$id.'ButtonUrl'},
'imageUrl'=>$this->{$id.'ButtonImageUrl'},
'options'=>$this->{$id.'ButtonOptions'},
);
if(isset($this->buttons[$id]))
$this->buttons[$id]=array_merge($button,$this->buttons[$id]);
else
$this->buttons[$id]=$button;
}报错提示:Fatal error: Using $this when not in object context in D:\Wamp\Apache\htdocs\1.01\this.php on line 9
以上这种写法,如何单独输出{view},{update}呢
同时以下代码片段还会报错foreach(array('view','update','delete') as $id)
{
$button=array(
'label'=>$this->{$id.'ButtonLabel'},
'url'=>$this->{$id.'ButtonUrl'},
'imageUrl'=>$this->{$id.'ButtonImageUrl'},
'options'=>$this->{$id.'ButtonOptions'},
);
if(isset($this->buttons[$id]))
$this->buttons[$id]=array_merge($button,$this->buttons[$id]);
else
$this->buttons[$id]=$button;
}报错提示:Fatal error: Using $this when not in object context in D:\Wamp\Apache\htdocs\1.01\this.php on line 9
解决方案 »
- php下载文件为空是怎么回事
- 请问$_POST['name']里面的name 有什么方法读取出来
- MYSQL如何统计每个时段(比如1天24个时段)的注册人数
- 帮忙分析下这段代码的执行过程。。。
- php与access的分页??
- PHP酒吧QQ群号码:8894982
- 关于ereg()的问题!
- 请问PHP中有延时函数吗?我想让程序延时一秒在执行
- 网页框架结构问题!
- 在<input value=...>中value的值可以是数组形式吗?
- 如何自动循环叠加打开ID=1这种形式的网站
- php提示错误 mysql_fetch_array() expects parameter 1 to be resource, boolean given
不久可以单独输出view和update了么?
$template='{view} {update} {delete}';
echo $template;
?>
output:
{view} {update} {delete}
view ,update,delete 分别对应yii grid中的查看按钮,更新按钮和删除按钮组件,需要哪个就加哪个。
比如,只需要view按钮:
$template='{view}';