![]() |
Need some advice to start building a new project - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Need some advice to start building a new project (/showthread.php?tid=3842) |
Need some advice to start building a new project - El Forum - 10-24-2007 [eluser]iive[/eluser] Hi, I am new to CI and MVC concept. Previously, I was building my own PHP classes to handle all the coding in PHP. And currently I am going to port my previous application into CI. But I have some queries in my mind currently, and I hope to get some advice from all of you here. I have read through the user manual and get the basic understanding on MVC. My application is a Flash gaming portal and the homepage will have some general information and a panel that show up all the current games available. I wonder how would my pages structure are in this homepage? Obviously I need a HomeController, and I need to call a GameController somewhere in the function of my HomeController to pull out all the games and display them in a seperate view? I hope I am on the right track... Need some advice to start building a new project - El Forum - 10-25-2007 [eluser]Unknown[/eluser] I would make a GameController with 'list' method, a Games model with 'GetGames($number?)' method that pulls game information from database and a GameList view to show it. index.php/game/list (list method of GameController) would call GetGames (from Games model) and load view GameList to display it. Thats how I code, but maybe someone uses better way. Need some advice to start building a new project - El Forum - 10-25-2007 [eluser]iive[/eluser] Thanks for your reply. Yes.. I will do the same as yours. that is when I access from index.php/game/list my problem is when I want to access from the homepage of my site(index.php/home/) where the game listing will just apprear inside 1 part of the page.... I have a HomeController with method index().. is it possible I can call GameController to help me to pull the data from db inside my HomeController::index() function? Need some advice to start building a new project - El Forum - 10-25-2007 [eluser]binlid[/eluser] You can set up a default route to the controller + method you want on your home page Need some advice to start building a new project - El Forum - 10-25-2007 [eluser]ballen[/eluser] [quote author="binlid" date="1193321911"]You can set up a default route to the controller + method you want on your home page[/quote] He just wants the data from it on the homepage, not the game list to be the homepage. I would put all the database stuff in the model, then load the Game model into the homepage, and access it that way. Hope that helps. Need some advice to start building a new project - El Forum - 10-25-2007 [eluser]iive[/eluser] thanks for all the helps.. Ballen, I am doing exactly what you said, I have a GameModel and loaded by my HomeController. But is it a good practise? I was thinking to have GameController to load GameModel and finally I load GameController within my HomeController... Can load another Controller inside a controller in CI ? |