I am currently developing an application with yii that shows (our own) incidents and persons associated to the incidents.
Now I am seeking help on how to design the views. I want to show an incident and all persons assigned to the incident. I have created an incidentController and a personController Class + crud with yiic.
I am currently modifying the actionShow Method of my IncidentController.
but my approach does not only feel wrong, it also creates the wrong result because the site's global layout get's rendered twice.
What's the 'right' way to solve the problem of rendering two models in one view?
Please excuse this dumb question, but I am stuck right now
I'd do it like this:
Load all associated persons in loadincident() by using with('persons') (or whatever your related attribute is called).
In view 'show', i'd render the view to show the person list, and supply the list of persons as parameter:
1. If there is the IncidentController and PersonController,
2. and we are rendering the show view of IncidentController
3. how can we list the show the Person list, which is part of the PersonController
Because if I do $this->renderPartial('person/list) inside the Incident view, I get an error.
Sorry, you should provide the view name like this, i think (not tried):
You can take a look at the reference docs of CController::renderPartial() or better CController::getViewFile() for more details.
Yes, what Mike suggested should work.
Mike, so you changed your display name. I didn’t recognize you at the first sight.
Mike, so you changed your display name. I didn't recognize you at the first sight.
Hehe, sorry for the confusion . Mike fits better and is easier to spell/pronounce than “mikl” (my old Prado name). Totally forgot to check, if Mike’s free, when registering here.