Some help.. |
[eluser]adamp1[/eluser]
Its a problem from the first route, because you used regex its catching the call to blog and sending it to main/blog As said you cant use full regex since it means you can only have one controller. So you need the following Code: $route['lists/(d+)'] = 'main/lists/$1';
[eluser]xwero[/eluser]
The last rout i gave you should be as low as possible in the routes configuration file because it's a very greedy match. There are a few options where you don't need to fill you routes configuration with all controllers you add, but if you only have a few controllers you can do Code: $route['(blog|admin)'] = '$1'; Code: $route['(lists|method2ofmain)'] = 'main/$1';
[eluser]zilverdistel[/eluser]
Great it works, but I have another suggestion for serving up static pages. I'd make a controller page.php Code: class Page extends Controller { then in your view folder, you can make all the static pages you want. if you make Page your default controller, you're set.
[eluser]oriceon[/eluser]
And if i say that i receive Page Not Found? I created this page.php into controller then into view i created html_start end and a about.php page. I made change in default controller then i acces http://localhost/CodeIgniter/about.html What is wrong?
[eluser]oriceon[/eluser]
I solved the problem. 1. Into routes.php i added: $route['default_controller'] = "statice"; $route['scaffolding_trigger'] = ""; $route['([a-z]+)'] = 'statice/index/$1'; 2. Into controllers i made a controller named statice.php then i have that code Code: class Statice extends Controller { Then into views i have pages: despre.php , statice.php and so on ... then if i load: http://localhost/codeigniter/ it`s load default page: statice.php from view else if i try http://localhost/codeigniter/despre.html it`s load despre.php so that i need!
[eluser]Shahgeb[/eluser]
try to understand segment of codeignitor userguide there is first segment is controller after project name and than comes function name so you must mention controller name like Blog/list hopes you want and work |
Welcome Guest, Not a member yet? Register Sign In |