Default method? |
[eluser]feejin[/eluser]
This is probably easy but I'm not sure what to search for! I have my site working as: Code: http://www.website.com/pages/index/name-of-page So it's using the 'pages' controller, using the default 'index' method and passing it 'name-of-page' as an argument. For neatness, I would like to just to be: Code: http://www.website.com/pages/name-of-page I've achieved this with the code below, but it feels clunky and am wondering if there's a better way of doing it? I've a feeling it might be better done with routes but would like a push in the right direction! Thanks, Colin Code: class Pages extends Controller {
[eluser]Clooner[/eluser]
You can easily use the routes for this. It is described in the manual : http://ellislab.com/codeigniter/user-gui...uting.html Code: $route['pages'] = "pages/index";
[eluser]feejin[/eluser]
Thanks, I thought it might be to do with routes but before pursuing it I wanted to make sure I was on the right... route
[eluser]mattpointblank[/eluser]
Just bear in mind with this approach that if you add any functions to your Pages controller, you'll have to manually re-route them in the routes.php file before they'll work, otherwise they'll be treated as arguments to index(). |
Welcome Guest, Not a member yet? Register Sign In |