Question about monolithic controllers and URL formatting

#1
[eluser]Mr.Mo[/eluser]
Hello All,

I'm new here, so my apologies in advance if this is a dumb question.

I would like to use CI on some small web sites (5-10 "pages").

It would work into my workflow very well if I could use a single controller for the majority of the pages. But I do not want to sacrifice simple URL's to do this.

Is there a way that a singles controller could handle URL's like:

site.com/
site.com/about-us
site.com/products
site.com/contact-us

while another controller takes care of forms processing

site.com/forms/submit
site.com/forms/ajax


What would be the most graceful way to do this ?

Much Thanks,
Mr.Moe

#2
[eluser]Ben Edmunds[/eluser]
For a basic site that would be fine.

Look up routes in the userguide. That will give you pretty urls with the functionality you want.

#3
[eluser]Mr.Mo[/eluser]
Thanks Ben,

I've tried doing this using a wildcard route, but it doesn't seem to work. The route I tried looked like this:

$route[':any'] = "master/$1";


I would like to avoid having to manually enter all of the function names a second time (1st in the controller, and then here) as it seems like it would be an easy place for things to get out of sync.

Thank you for your help, I am liking CI and the community here very much!

-Mr.Moe

#4
[eluser]Mr.Mo[/eluser]
Woops, my bad, I should have been using:

$route[’(:any)’] = “master/$1”;


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.