Hello,
I heve question and some problem.
I have two model : Task and Project.
Project has relation:
'tasks' => array(self::HAS_MANY, 'Task', 'project_id'),
I wanna render Task view in Project view. How to do it?
Hello,
I heve question and some problem.
I have two model : Task and Project.
Project has relation:
'tasks' => array(self::HAS_MANY, 'Task', 'project_id'),
I wanna render Task view in Project view. How to do it?
Take a look at renderPartial.
Yes, i used now in view project :
<td><?php $this->renderPartial('//task/_view', array('data'=>$data)); ?></td>
but i returning me :
Property "Project.content" is not defined.
Project :
-ID
-AUTHOR_ID
-DEADLINE
-NAME
Task :
-CONTENT
-ID
-DEADLINE
-CREATED
-FINISHED
-AUTHOR_ID
-USER_ID
-PROJECT_ID
-PRIORYTET
foreach($data->tasks as $task) { echo $task->content . ‘<br/>’; }
Dear Friend
In views/project/view.php you can add the following .
<?php $this->widget('zii.widgets.CListView', array(
'dataProvider'=>new CArrayDataProvider($model->tasks),
'itemView'=>'//task/_view',
)); ?>
Regards.