I was wondering how I can render multiple controller methods while accessing only one controller (in Yii Framework). So for example “controller/SiteController.php” (method “actionIndex”) is called in the browser.
- Witch first renders the output of “controller/UserController.php” (method “actionDetails” -> “views/user/details.php”).
- And after that also renders the output of “controller/SiteController.php” (method “actionIndex” -> “views/site/index.php”) for the rest of the page.
Hope someone can help? I’m still kinda new to Yii. Thanks in advance.
It can be done, afterall a action is also a function isn’t it..so we can call it..
In your first action after its render..Make an instance of the desired controller, in your case SiteController, call member function of it, in your case
actionIndex().Controller construct documentation
Ideally as a mvc practice you shouldn’t do this, instead make separate ajax requests form the page to get the contents from separate actions..