markux
(Marco Patania)
December 27, 2010, 6:41am
1
Hello everybody ,
I’ve this organs hierarchy:
OrganController
ColonController
BreastController
I’ve this view: themes/classic/views/organ/analysis.php
I need to renderer from Colon and Breast controller this analysis. I tried in this way on OrganController:
public function renderAnalysis()
{
// $this->id = 'Organ'; // error becaus id read-only
$this->render('analysis', $this->data);
}
colon e breast call this inherited function, but yii doesn’t find the view, because it search colon/analysis.php.
FlyBot
(Flybots)
December 27, 2010, 8:06am
2
$this->render(’../organ/analysis’, $this->data);
markux
(Marco Patania)
December 27, 2010, 8:58am
3
I tried this solution, but it doesn’t work
FlyBot
(Flybots)
December 27, 2010, 9:06am
4
call
renderPartial('../organ/analysis', $this->data);
from colon’s view
markux
(Marco Patania)
December 27, 2010, 10:12am
5
ok, I have to create views/colon/analysis.php with this content:
<?php $this->renderAnalysis(’../organ/analysis’);?>
And on ColonController actionIndex:
public function actionAnalysis()
{
parent::actionAnalysis();
$this->renderPartial('analysis');
}
It works in this manner, but the best solution would be to call directly from the view controller Colon organ/analysis.php, without having to create the folder views/colon.
thanks
markux
(Marco Patania)
December 27, 2010, 5:00pm
6
From parent controller:
$this->render(‘webroot.themes.classic.views.organ.analysis’, $data));