How to call controller method inside CDetailView?


I tried calling a controller method inside a CDetailView column, but it gave me a CException:

$this->widget('zii.widgets.CDetailView', array(











What’s wrong with it?

$this in this case refers to the widget.

use Yii::app()->controller instead

I tried what you suggested, but received an error Property "Flowbook.Yii" is not defined.


not Yii::app()->FlowbookController::convertTime

but Yii::app()->controller->convertTime

you should also use $data->create_time, not create_time, so finally write:


Thanks! It’s working!