Welcome Guest, Not a member yet? Register   Sign In
best practice for creating sections within a site. Different controllers vs one controller
#1

[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
#2

[eluser]rogierb[/eluser]
The easy way out is using routes:

Code:
$route['company/locations'] = 'locations';
$route['company/locations/(.+)'] = 'locations/$1';
This way your URL is fixed.

But you might want to take a closer look into Modular Separation or HMVC.
I get the feelings this is what you want.
#3

[eluser]td234[/eluser]
THanks. That is exactly what I am looking for.
#4

[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.




Theme © iAndrew 2016 - Forum software by © MyBB