CodeIgniter Forums
How to combine all different views in a controllers? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: How to combine all different views in a controllers? (/thread-44957.html)



How to combine all different views in a controllers? - El Forum - 09-01-2011

[eluser]ted wong[/eluser]
I know all the controllers can load as many view as they want. But here is the situation:

I got a user controller, which have a show_user_login_status, that load a small fragment of the page. Let say, print back the user login name, and short cut for logout....bababa. And I also have a forum controller, which show the post from the db.... All these pages is only a fragment of a page....But I would like to combine them all to become a real website. So, I am thinking how to do it....Let say I have the main controller to deal with this. But the main controller need to call the user controller and forum controller. It seems violate the ideas of separate them...ok, you may say just make a iframe to do so, but I think it is a different story.....

Did I misuse the system of codeIgniter? How you do these kind of integration. Please suggest.

Here is what I have
user controller
+show_user_login_status //do all the user login status logic, for example, read data from db, session, bababba
-load_user_login_status //show_user_login_status will pass the data it needs, and display

forum controller
+show_post($aPostId) //do all the post logic, read the post from db, bababa, and call the load_post
-load_post

Now I need a main controller to combine them
+show_forum_post //I ready have the logic in forum controller and user controller.
-load_forum_post //the view already have in user controller and forum controller