Welcome Guest, Not a member yet? Register   Sign In
How to accomplish this > www.mysite.com/username/controller/function/id
#4

[eluser]Leonard Yulianus[/eluser]
[quote author="ervinter" date="1225884310"]I am looking for this as well as I need to provided every registered member their profile page. Example, twitter.com/username[/quote]

some thought...

create a controller file (e.g user.php)
then make view function

Code:
function view($username) {
$this->db->where('username', $username);
$query = $this->db->get('users');
if ($query->num_rows()) {
// username matchs!, then do whatever with this user

} else {
// username not found! throws some error!

}
}

then add this line to application/config/routes.php
Code:
$route['(.*)'] = "user/view/$1";

note:
i haven't tested it yet, but i think it should work fine...


Messages In This Thread
How to accomplish this > www.mysite.com/username/controller/function/id - by El Forum - 11-04-2008, 11:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB