Some help.. |
[eluser]oriceon[/eluser]
Hello all, i`m new on coding sites with a framework.. I have a question: how could i acces in browser some functions from default controller (main) without access: http://www.site.com/main/myfunction.html .. I want to access http://www.site.com/myfunction.html but this one to came from main controller. Thanks
[eluser]zilverdistel[/eluser]
in the file system/application/config/routes.php, you have to change Code: $route['default_controller'] = "welcome"; to Code: $route['default_controller'] = "main"; if you want '.html' added to your urls, edit system/application/config/config.php. Look for the line Code: $config['url_suffix'] = "";
[eluser]oriceon[/eluser]
I have that one and nothing happened that i want. :| Code: <?php When i access http://localhost/site/ it load blog_view because blog controller is default, so is ok. If i access http://localhost/site/blog/lists.html it is ok, print me aaaa. Now, i want to access only http://localhost/site/lists.html without blog parameter (as a controler) because it is supposed to be default one... So, how to? Thanks
[eluser]zilverdistel[/eluser]
I see ... you might try something like this. I'm not sure if the regualar expression used is what you want, but as an example this can serve: Code: $route['/([a-z]+)/(\d+)'] = "blog/$1/$2"; it goes in application/config/routes.php, at the bottom of the file. There's a section in the user guide about this: http://ellislab.com/codeigniter/user-gui...uting.html.
[eluser]oriceon[/eluser]
not workin, i trying alot of stuff and no result. Could you made a test and give me a good example? Thanks
[eluser]zilverdistel[/eluser]
can you post the entries in your routes.php config file?
[eluser]oriceon[/eluser]
Code: $route['default_controller'] = "main"; At mine default controller is main.. i changet from blog into main. And in controller same.. Blog to Main
[eluser]adamp1[/eluser]
I don't get why you want to exclude the controller name. By doing so and using routes with the regex above, you will only be able to access 1 controller for the entire site??
[eluser]oriceon[/eluser]
I want to create some static pages and i don`t want to access: http://localhost/static/page-name.html .. i want http://localhost/page-name.html and for that i see that i must create a controller .... then a index function.. and i don`t want that. It is another way.. ?
[eluser]adamp1[/eluser]
You would be better off with this Code: $route['lists/(\d+)'] = "main/lists/$1"; |
Welcome Guest, Not a member yet? Register Sign In |