![]() |
best practice for creating sections within a site. Different controllers vs one controller - 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: best practice for creating sections within a site. Different controllers vs one controller (/showthread.php?tid=24806) |
best practice for creating sections within a site. Different controllers vs one controller - El Forum - 11-20-2009 [eluser]td234[/eluser] HI. I have been working with Ci for a few months now and am hooked. I have a question about design though and wanted to get some expert advise. I have been building different controllers for various operations in my site. I now would like ot be able to organize these operations into sections. For example, I have controllers for company, locations, agents, clients, etc. From a site design standpoint I would like all these items to be in my "company" section of the site. So far I have build an array of all controllers that belong in this section and build my navigation for this section and on that array. This works fine, but my URLs do not correspond to my site layout. For example, my location section looks like it is in the company section, but the URL is /locations, not /company/locations/ How is everyone else dealing with this sort of issue? Thanks! Thom best practice for creating sections within a site. Different controllers vs one controller - El Forum - 11-20-2009 [eluser]rogierb[/eluser] The easy way out is using routes: Code: $route['company/locations'] = 'locations'; But you might want to take a closer look into Modular Separation or HMVC. I get the feelings this is what you want. best practice for creating sections within a site. Different controllers vs one controller - El Forum - 11-21-2009 [eluser]td234[/eluser] THanks. That is exactly what I am looking for. best practice for creating sections within a site. Different controllers vs one controller - El Forum - 11-29-2009 [eluser]Jeremy Gimbel - Conflux Group[/eluser] For more CMS-oriented projects, I've been using controllers more based on functionality, ie, a controller for standard pages, photo galleries, contact form, etc. and then using routes to direct the URLs accordingly to the correct controller based on the functionality needed. |