CHtm::Mailto Link in CGridview [SOLVED]

Hi I am trying to display an email address which is stored in my table column ‘Bank_Contact_Email_1’ as a html mailto link in CGridview is there any reason why the following wont work.





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

	'dataProvider'=>$dataProvider,

	'columns' => array(

array('name'=>'Bank_Contact_Email_1','type'=>'raw','value'=>CHtml::mailto($email=$model->Bank_Contact_Email_1)),

//rest of code as normal.



I am displaying the column with heading but no linked value in each row i’m presuming that there is a problem with my CHtml::mailto() any input would be greatly appreciated.

Thank you

Ibecake

Any Takers.

Ibecake

Try this:




array('name'=>'Bank_Contact_Email_1','type'=>'raw','value'=>'CHtml::mailto($data->Bank_Contact_Email_1)'),



Brilliant works perfect.

Thanks

Ibecake

This should also work:




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

	'dataProvider'=>$dataProvider,

	'columns' => array(

'Bank_Contact_Email_1:email',

//rest of code as normal.



Edit to fix small error in my original post

One can also add the display name by writing something like this:




array(

   'name'=>'Email',

   'type'=>'raw',

   'value'=>'CHtml::mailto(CHtml::encode($data->email), $email=CHtml::encode($data->first_name)." ".CHtml::encode($data->last_name). " <".CHtml::encode($data->email).">")',

		),