Welcome Guest, Not a member yet? Register   Sign In
Routing with variable in position 2 and function in position 3
#1

[eluser]duffy0[/eluser]
So I am working on building an online social network and have loved the pretty url's so far, but I have been stumped. I really want to have a url like this:

http://www.example.com/index.php/profile.../following

Where "profile" is my controller, "duffy0" is the username and variable to get the data from the database, and finally "following" which is the function inside the controller.

How would I do this?
#2

[eluser]umefarooq[/eluser]
hi you can do like this

Code:
$route['profile/([a-zA-Z_-]+)/([a-zA-Z_-]+)'] = 'profile/$2/$1';

from you url it will take 2nd segment following and 1 segment as you username try it will work




Theme © iAndrew 2016 - Forum software by © MyBB