CDetailView

I am relatively new to Yii.

I am facing an issue whereby I am unable to display multiple data using CDetailView.


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

	'data'=>$model,

	'attributes'=>array(

		array(

			'name' => 'Packing Size',

              		'type' => 'raw',

              		'value' => '***To list packing_size_1, packing_size_2, packing_size_3'***',

              		'filter'=>false,

		),

		/*

		'packing_size_1',

		'packing_size_2',

		'packing_size_3',

		*/

	),

)); ?>

Any help is greatly appreciated.

Thank you.

Create a function in your model to concatinate your three values and call the function in the value "value"=>mysweetgetfunction(),

I received the error below:

Fatal error: Call to undefined function getpackingsize()

I have placed the function in models. Am I missing something?

Thank you.

should be straight forward try this




<?php


// in your model

...

public function getPackingSize()

{

	return $this->packing_size_1 . $this->packing_size_2 . $this->packing_size_3;

}

...


// then change your grid like so

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

	'data'=>$model,

	'attributes'=>array(

		'packingSize',

		/*

		'packing_size_1',

		'packing_size_2',

		'packing_size_3',

		*/

	),

));