CodeIgniter Forums
more one controller - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: more one controller (/showthread.php?tid=27577)



more one controller - El Forum - 02-15-2010

[eluser]Herton Vilarim[/eluser]
hello, my name is Herton!

i'm from Brazil this is first post on forum, i look examples one controller, i care to look examples how is use two or more controllers on my site. Sorry my bad english.


more one controller - El Forum - 02-15-2010

[eluser]danmontgomery[/eluser]
Hi Herton,

You can create as many controllers as you'd like, you just use the URI structure:

Quote:http://www.yourdomain.com/[controller]/[method]/[parameter]

This is assuming CI is installed in webroot (/) and .htaccess is used to remove index.php

For example, if you have a "News" controller and a "Blog" controller, you might access each of them this way

Quote:http://www.yourdomain.com/news/view/128
http://www.yourdomain.com/blog/edit/this-is-a-blog

The first would look for:

Controller: News
Method: view()
Parameter: 128

The second for:

Controller: Blog
Method: edit()
Parameter: "this-is-a-blog"

You can pass as many parameters as you'd like, or define custom routing to specify how this parameters will be passed. http://ellislab.com/codeigniter/user-guide/general/routing.html


more one controller - El Forum - 02-15-2010

[eluser]Herton Vilarim[/eluser]
thank you!