Yii 1.1.15
Windows 7 Professional SP1 64-bit
XAMPP Server 1.8.3
Apache 2.4 ,
PHP 5.5.15
Hi, i’m trying to add a image on a grid column
I recive this error on the column, the rest of the page renders well.
[color="#FF0000"]Parse error: syntax error, unexpected ‘<’ in X:\www_dev\yii\framework\base\CComponent.php(612) : eval()'d code on line 1[/color]
this is my view (grid part)
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'user-grid',
'itemsCssClass'=>'table table-hover table-striped table-bordered table-condensed',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'username',
'email',
'firstname',
'lastname',
'created',
'lastvisit',
array(
'name' => 'active',
'type' => 'html',
'value' => CHtml::image(UtilityHTML::getStatusImage(1),UtilityHTML::getImagetitle(1),array('width'=>50, 'height'=>50))
),
array(
'class'=>'CButtonColumn',
),
),
)); ?>
this is a component to get image by status
<?php
class UtilityHTML
{
public static function getImagetitle($status) {
if ($status == 1) {
return 'Active';
} else {
return 'Inactive';
}
}
public static function getStatusImage($status) {
if ($status == 1) {
return Yii::app()->request->baseUrl . '/images/ui/status_1.png';
} else {
return Yii::app()->request->baseUrl . '/images/ui/status_0.png';
}
}
}
Thank you
Pablo