Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Cgridview With An Image Column Doesn't Render

$
0
0
Hi guys,

I have an image column in a CGridView widget, it partially works, the following code works:

array('type'=>'html',
      'value'=>'CHtml::tag("img", array("src" => "http://www.gravatar.com/avatar/00000000000000000000000000000000?d=mm&s=60"),"",true)'
),


As you can see, the url is hardcoded, so instead, I have created a function that recovers an url:

AccountController::getPhotoUrl($data->author_id, $data->photo)


I have tried in several ways, but I just can't get this done, nothing of this works:

array('type'=>'html',
      'value'=>'CHtml::tag("img", array("src" => "AccountController::getPhotoUrl($data->author_id, $data->photo)"),"",true)'
),

//This render something like this: CHtml::image(AccountController::getPhotoUrl(1, https://graph.facebook.com/XXXXX/picture?type=square))
//Which is correct, because its passing the correct values to the function
array('type'=>'html',
      'value'=>'"CHtml::image(AccountController::getPhotoUrl($data->author_id, $data->photo))"'
),

array('type'=>'image',
      'value'=>"AccountController::getPhotoUrl($data->author_id, $data->photo)"
),


I would really appreciate if someone can help me. Thanks!

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>