![]() |
Organizing Views (with Matchbox lib) - 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: Organizing Views (with Matchbox lib) (/showthread.php?tid=6326) |
Organizing Views (with Matchbox lib) - El Forum - 02-22-2008 [eluser]Armorfist[/eluser] I'm building my CMS with CI and I'm trying to figure the best way to organize my views so that i dont repeat load->view every time i want to load the backend header for example. This is how I'm doing it: For example, under the module "users" in the "application/modules/users/controllers/admin" directory, i have a controller named "admin" that has the following code: Code: <?php And under the folder "application/modules/users/views/admin" i have a view named teste.php with the following code: Code: Test Now, under "application/views" i have a folder named "backend", which contains: header.php - The header html code of the backend menu.php - The menu of the backend footer.php - The footer html code of the backend login.php - The view that contains the login form Then i have "cointainer.php", the view that loads the "header", "menu" and "footer" view along with the "content" view. The code: Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); Am i doing this right? Suggestions will be greatly appreciated. Organizing Views (with Matchbox lib) - El Forum - 02-24-2008 [eluser]Armorfist[/eluser] Any one? ![]() If i didn't explain myself well, please tell me. Thanks Organizing Views (with Matchbox lib) - El Forum - 02-24-2008 [eluser]adamp1[/eluser] You have done it exactly like me, but I don't like having to pass the module name over to it for when I want to load a module view. Iv been racking my brains to try and find a cleaner simpler way but so far can't think of one. Organizing Views (with Matchbox lib) - El Forum - 02-25-2008 [eluser]Armorfist[/eluser] Good point, i think one way of doing that is to get the URI segment correspondent to the module. Going to try that, at least its one less thing I have to specify in the controller. Organizing Views (with Matchbox lib) - El Forum - 02-25-2008 [eluser]adamp1[/eluser] Problem is what if you have a controller with the same name as the module. You then don't pass the module name so that information won't be there? Organizing Views (with Matchbox lib) - El Forum - 02-25-2008 [eluser]Armorfist[/eluser] I get your point, but i don't intend to use the "container.php" view for controllers that aren't inside modules, at least for the backend. |