Welcome Guest, Not a member yet? Register   Sign In
functions parameter in the first segment of url
#1

[eluser]hueman[/eluser]
hello everybody
in some parts of my project i need to put my fucntion's parameter in the first segment of url like this:
Code:
example.com/param/class/function
i want to remmap above url to this:
Code:
example.com/class/function/param
how can i do this?
thanks a lot
#2

[eluser]mddd[/eluser]
You would have to make a route for it. Like
Code:
$route['([^/]+)/class/function'] = 'class/function/$1';
#3

[eluser]hueman[/eluser]
[quote author="mddd" date="1279286053"]You would have to make a route for it. Like
Code:
$route['([^/]+)/class/function'] = 'class/function/$1';
[/quote]
thank you about your solution
my project was extended and now i think its necessary to define param to use it anywhere in my code
how can i define param?
should i customize router?
thank you again
#4

[eluser]mddd[/eluser]
You could easily turn all three uri segments info variables and shuffle them around:
Code:
$route['([^/]+)/([^/]+)/([^/]+)'] = '$2/$3/$1';
That will take any three segment uri and move the parts in the order you like.
(But then again: if you do that on every page why are you doing it at all? You might as well leave the uri's in the normal way.)
#5

[eluser]hueman[/eluser]
[quote author="mddd" date="1279798354"]You could easily turn all three uri segments info variables and shuffle them around:
Code:
$route['([^/]+)/([^/]+)/([^/]+)'] = '$2/$3/$1';
That will take any three segment uri and move the parts in the order you like.
(But then again: if you do that on every page why are you doing it at all? You might as well leave the uri's in the normal way.)[/quote]
thank you for your reply
my project is a real state and i try to use urls like this:
Code:
example.com/city/class/function
city is a parameter for example:
Code:
example.com/london/rent
this urls show every states for rent in london
Code:
example.com/paris/sell
this urls show every states for sell in paris
Code:
example.com/all/sell
this urls show every states for sell anywhere

i tried to create automated subdomains with CI and use following urls but i failed:
Code:
london.example.com/rent
Code:
paris.example.com/sell
i need city parameter in every pages
how can i define city parameter?




Theme © iAndrew 2016 - Forum software by © MyBB