URL problem |
[eluser]Josssi[/eluser]
Hi people ![]() now I have problem with correct URL creating. When my url is after base_url composed of 2 elements, for example ..../forum/note...and I click in my menu on HOME, my new URL have to be ...../home...Problem is, that the first URL element stays an is created new URL like .../forum/home. Have you somebody some advice for me how to make it correct please? PS:"Rewrite module i have turned on."
[eluser]InsiteFX[/eluser]
Try adding this to your ./application/config/routes.php file Code: $route['home'] = 'forum/home';
[eluser]Josssi[/eluser]
this i have done, but it is problem by url, where is last parameter generated dynamicali as ID for example, there I cant to give all ID to route, its not effectial reason...
[eluser]InsiteFX[/eluser]
You did not state that you wanted to pass parameters to it! Code: $route['home/(:any)'] = 'forum/home/$1';
[eluser]Josssi[/eluser]
Thank you for reaction, but it still isnt this right what I need ![]() Code: $route['home/(:any)'] = 'forum/home/$1'; On the right site I need to set not concrete thirt param of url. Something like: Code: $route['home/(:any)'] = 'forum/home/(:whatever)'; It was supreme if I could in config root file use function, which returns ID of logged user, but it isnt possible, or isnt it?
[eluser]InsiteFX[/eluser]
Well if you have a users login system then you should be able to store the users id in a session variable. The other way you could do it would be to use the _remap() method.
[eluser]Josssi[/eluser]
Sorry, but I am donk of remap. I read guide, I am trying to use them, but failed every time. How can I use it in my case? How has to look anchor with remap, to I achieve this same as with Code: echo 'anchor('user/edit/'.$user->id,'Edit profile');
[eluser]InsiteFX[/eluser]
You can also try to use this: Code: $id = $this->uri->segment(n) CodeIgniter Users Guide - URI Class
[eluser]Josssi[/eluser]
Thanks, it helps me for this time. I set: Code: $route['(:num)']= 'user/edit'; Code: function edit() Now it helped me, but now I have next problem, I need to solve something similar once more. As I have in other topic written already, I have got table of products, where name each of them will as a link. This links will be designed this way: Code: echo 'anchor(product/edit/product_id)'; Code: $route['(:num)']= 'product/edit'; PS:"Just reminging, my uri address cant have more than one segment afther base_url, because when entering new uri, overwritten ist just last segment and the first one -i dont know whay- stays old, it is overwritten not:/" |
Welcome Guest, Not a member yet? Register Sign In |