Welcome Guest, Not a member yet? Register   Sign In
User profiles and routing
#1

[eluser]JamieBarton[/eluser]
Hi guys,

Here is my controller I've just set-up..

Now, I want to be able to go to some of the following URLs, and the appropriate views to show up. Hopefully someone can adjust my controller, and suggestion the Routes too..

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Users extends CI_Controller {
    
    public function index()
    {
        redirect(base_url());
    }
    
    public function view_profile()
    {
        $this->load->view('users/view_profile');
    }
    
    public function attending()
    {
        $this->load->view('users/attending');
    }
    
    public function venues()
    {
        $this->load->view('users/venues');
    }
    
    public function artists()
    {
        $this->load->view('users/artists');
    }
    
    public function friends()
    {
        $this->load->view('users/friends');
    }
    
    public function followers()
    {
        $this->load->view('users/followers');
    }
    
    public function following()
    {
        $this->load->view('users/following');
    }
}

/* End of file users.php */
/* Location: ./application/controllers/users.php */

The route I tried is:

Code:
$route['users/(:any)'] = "users/view_profile/$1";

However.. That would only pass in the username, but what I want to do, is go to the profile, append a method after the username, and get it to work properly..

Can't seem to get my head around how to do this.. Or it's late and I'm being silly..!


Thanks!

J Smile


Messages In This Thread
User profiles and routing - by El Forum - 03-23-2011, 03:10 PM
User profiles and routing - by El Forum - 03-23-2011, 03:15 PM
User profiles and routing - by El Forum - 03-31-2011, 04:28 AM
User profiles and routing - by El Forum - 03-31-2011, 07:53 AM
User profiles and routing - by El Forum - 03-31-2011, 11:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB