Hello,
I am new to YII doing some R&D.
I was able to put to different CRUDS together in a single page. For instance, I have one Student CRUD and a Teacher CRUD. I am displaying student and teacher list in the student/admin page. Also, I have put a search link for Teacher. But the when I click on the link, it takes me to the student search div which is on the same page, the reason is in url it takes student/admin#. I want to change the anchor from student/admin# to parent/admin#. Similarly, in the teacher table for view/edit/delete it takes student in the url.
Below is the code:
View code:
<?php echo CHtml::link('Teacher: Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
'model'=>$teacherModel,
)); ?>
</div><!-- search-form -->
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'teacher-grid',
'dataProvider'=>$teacherModel->search(),
'filter'=>$teacherModel,
'columns'=>array(
'id',
'firstname',
'lastname',
'age',
array(
'class'=>'CButtonColumn',
),
),
)); ?>
Controller code:
in function actionAdmin
include('TeacherController.php');
$teacherModel = new Teacher('search');
$teacherModel->unsetAttributes();
and passing $teacherModel to $this->render
Can anyone please help me out?
Thanks in advance.