2013-11-23 15 views
0

我试图打印gridview的形象,但我有以下错误,如果我在视图页面万事都打印出来,所以 有什么不对? enter image description here 查看代码:打印图像中的GridView返回错误

 <?php 
     $assetsDir = Helper::UPLOAD_DOMAIN_URL . Helper::PRODUCT_UPLOAD_FOLDER . Helper::Countries; 
    // return http://localhost/upload/ssofiles/countries/ 
     ?> 

     $this->widget('application.components.GridView.BSGridView', array(
       'id' => 'countries-grid', 
       'dataProvider' => $model->search(), 
       'filter' => $model, 
       'columns' => array(
       'co_id', 
       'country', 
       'country_e', 
       'country_f', 

       'code', 
       array(
         // 'value'=>'Yii::app()->request->baseUrl."/upload/".$data->image' 
         'name' => 'image', 
         'type' => 'html', 
         'value' => '(!empty($data->image))?CHtml::image($assetsDir$data->image),"",array("style"=>"width:25px;height:25px;")):"no image"', 

       ), 
...............   

?> 
+0

你找到你的答案吗? 。 – tinybyte

+0

无:(,和我没有任何解释为什么不工作 –

回答

0

我固定它通过呼叫路径直接在我的代码是这样的:

array('name' =>'image','filter'=>false, 'value' => 'CHtml::link(
      CHtml::image(Helper::UPLOAD_DOMAIN_URL . Helper::PRODUCT_UPLOAD_FOLDER . Helper::Countries . $data->image, $data->image, array("width"=>32,"height"=>32)), 
      Helper::UPLOAD_DOMAIN_URL . Helper::PRODUCT_UPLOAD_FOLDER . Helper::Countries . $data->image,array("id"=>"add"))', 
      'type' => 'raw', 
     ), 
0
'code', 
      array(
        // 'value'=>'Yii::app()->request->baseUrl."/upload/".$data->image' 
        'name' => 'image', 
        'type' => 'html', 
        'value' => '(!empty($data->image))?CHtml::image($assetsDir$data->image),"",array("style"=>"width:25px;height:25px;")):"no image"',// typo 

      ), 

...............

变化

'code', 
      array(
        // 'value'=>'Yii::app()->request->baseUrl."/upload/".$data->image' 
        'name' => 'image', 
        'type' => 'html', 
        'value' => '!empty($data->image) ? CHtml::image($assetsDir . $data->image,"",array("style"=>"width:25px;height:25px;")) : "no image"', 

      ), 

...... .........

+0

谢谢你,但同样的错误 –

+0

我改变了代码,尝试再次 – tinybyte

+0

也没有工作,回到 未定义的变量:assetsDir ,所以我改变了它是 的价值'=>'!empty($ data-> image)?CHtml :: image('。$ assetsDir。'。$ data-> image,“”,array(“style”=>“width:25px; height:25px ;“)):”没有图像“,但没有工作 –