Yii Framework Forum: Help with syntax!! - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Help with syntax!! Rate Topic: -----

#1 User is offline   Jimlam 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 195
  • Joined: 17-March 12

Posted 28 June 2012 - 03:54 AM

I am trying to insert a link in a column of a cgridview. This link will lead to another cgridview based on an attribute value of the row in the 1st cgridview. I am having a parse error with a particular CHtml::link

Here's is the code:


<?php $dataProvider=new CActiveDataProvider('Department'); ?>

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

	'id'=>'department-grid',

	//'dataProvider'=>$dataProvider,
	'dataProvider'=>$model->search(),	

	'columns'=>array(

		'id',
		'name',
		array('name'=>'empname', 'type'=>'raw', 'value'=>'CHtml::link('Eyees', $this->createUrl('employee/admin'),array('id'=>'$data->id'))'),
		array(

			'class'=>'CButtonColumn',

		),

	),

)); ?>


Am I missing something? I've edited several times but without success :((
0

#2 User is offline   Rajith R 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 920
  • Joined: 20-April 11
  • Location:India

Posted 28 June 2012 - 04:16 AM

use like this, need class CLinkColumn
array(
            
        'class'=>'CLinkColumn',
        'labelExpression'=>'$data->name',
		'urlExpression'=>'Yii::app()->createUrl("/courses/exams/create",array("exam_group_id"=>$data->id,"id"=>$_REQUEST["id"]))',
        'header'=>'Name',
		'headerHtmlOptions'=>array('style'=>'color:#FF6600')
        ),

Rajith Ramachandran,
Wiwo inc.
| Mobile: 919995504508
0

#3 User is offline   Jimlam 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 195
  • Joined: 17-March 12

Posted 28 June 2012 - 04:30 AM

Thanks Rajith,

I'll try it and get back to you. Hope it works: I've been wasting hours on this!
0

#4 User is offline   Jimlam 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 195
  • Joined: 17-March 12

Posted 28 June 2012 - 07:22 AM

Hi Rajith,

Have not been able to make it work: parse error in syntax :angry:
0

#5 User is offline   mbi 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 617
  • Joined: 08-May 09

Posted 28 June 2012 - 08:23 AM

http://blog.mbischof...nyme-funktionen
0

#6 User is offline   Jimlam 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 195
  • Joined: 17-March 12

Posted 28 June 2012 - 09:16 AM

View Postmbi, on 28 June 2012 - 08:23 AM, said:



It works!!!!!! I do not know how to thank you. I've wasted hours on this :-*


Bianca


PS Thanks to all of you who have tried to help me. This YII community is wonderful !!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users