自定义标签使用变量出错

浏览:824 发布日期:2013/12/23 分类:求助交流
$this->assign('model',$model);
        $this->assign('where',$where);
 <cdn:list model="$model" where="$where"> 这样 页面报错

应该怎么写啊 public function _list($attr,$content){
    $table = !empty($tag['model'])?$tag['model']:MODULE_NAME;
    $where = !empty($tag['where'])?$tag['where']:'';
    $str = '<?php ';
        $str .= '$_'.$table.' = M("'.$table.'")->where("1 '.$where.'")->select();';
        $str .= '$'.$index.'='.$indexValue.';';
        $str .= 'foreach($_'.$table.' as $'.$key.'=>$'.$value.'): $'.$index.'++ ; ?>';
        $str  .=   $this->tpl->parse($content);
        $str .= '<?php endforeach; ?>';
        if(!empty($str)) {
            return $this->tpl->parse($str);
        }
        return ;
    }
最佳答案
评论( 相关
后面还有条评论,点击查看>>