route all URL to only one controller! |
[eluser]Unknown[/eluser]
I want to use smarty as template, and I want to use URL like www.myserver.com/index.php/templategroup/templatename/parm1/parm2/.... templategroup and templatename will be fetched from database. for that need to have only controller to do this. I don't know how to do this.
[eluser]wiredesignz[/eluser]
Read the user guide: http://ellislab.com/codeigniter/user-gui...uting.html http://ellislab.com/codeigniter/user-gui...#remapping
[eluser]Unknown[/eluser]
I got it using regExp routing: $route['(.*)'] = "site/$1"; @wiredesignz thanks for the hints
[eluser]systemsos[/eluser]
[quote author="amirbukhari" date="1203271667"]I got it using regExp routing: $route['(.*)'] = "site/$1"; @wiredesignz thanks for the hints[/quote] I used the $route[':any'] = 'my_default_controller' Then worked out it killed everything else unless I added it manually below it; $route['blog/:any'] = 'my_blog_controller' $route['blog'] = 'my_blog_controller' So I figured it was probably best to only forward the bits I wanted, rather than everything and then minus out the parts I wanted to keep going to their own controller.
[eluser]zauber[/eluser]
I needed to do something similar, and ended up extending the Router class (it's a real small and simple extension). I wanted any requests like: http://mysite.com/some_page_name to be equivalent to: http://mysite.com/page/read/some_pag_name. ... and I wanted to set it up in routes with "$route['default_query'] = 'page/read';" Perhaps not exactly what you need, but it might give you some ideas for what is possible. Here's my original post that has the extension I made (didn't get any responses yet): http://ellislab.com/forums/viewthread/71877/ |
Welcome Guest, Not a member yet? Register Sign In |