Welcome Guest, Not a member yet? Register   Sign In
domain.com/$id or $username or w/e [solved]
#1

[eluser]DADE[/eluser]
Hello,

I have a problem:

Well. I need someting like this:

When someone enters http://example.com/, he sees welcome page or w/e. It's easy.

Code:
function index()
{
   $this->load->view('welcome');
}

But when someone enters http://example.com/Username, I need to load different page, witch shows info about user or w/e.

I tried something like:

Code:
function index()
{
    if($this->uri->segment(1) === FALSE)
    {
        $this->load->view('welcome');
    }
    else
    {
        $this->db->where('username', $this->uri->segment(1));
        $data['users'] = $this->db->get('users');
        $this->load->view('profile', $data);
    }
}

But of course it's not work.

So question is:

How I can load http://example.com and get welcome.php page, and how I can load http://example.com/username and get profile.php page?

I saw something about routes but I don't really understand something. :\ Maybe somebody write detailed information.

Thanks.


Messages In This Thread
domain.com/$id or $username or w/e [solved] - by El Forum - 08-30-2010, 06:08 PM
domain.com/$id or $username or w/e [solved] - by El Forum - 08-31-2010, 01:24 AM
domain.com/$id or $username or w/e [solved] - by El Forum - 08-31-2010, 02:13 AM
domain.com/$id or $username or w/e [solved] - by El Forum - 08-31-2010, 02:17 AM
domain.com/$id or $username or w/e [solved] - by El Forum - 08-31-2010, 02:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB