Welcome Guest, Not a member yet? Register   Sign In
How to display a users personal page from URL - mysite/username
#14

[eluser]CroNiX[/eluser]
It's because of your single catch-all route. It's telling every request to go to the login controller. And, since you are using _remap() in that controller, everything goes there. You need to set additional routes up now for your other controllers, before your catch-all route, and adjust your _remap() (you never mentioned you had other methods in there that needed to be accessed).

Code:
$route['contact'] = 'contact'; //will go to contact/index

Code:
public function _remap($method, $params = array())
{
  if (method_exists($this, $method))  //this should work for your 'validate()' method
  {
    echo $method;
    print_r($params);
    return call_user_func_array(array($this, $method), $params);
  }
  else
  {
    // actual method doesn't exist, check if request was for a user
    $user_info = $this->membership_model->get_member($method);
    if(count($user_info) > 0)
    {
      // Display the user with the profile page.
      $data['user_info'] = $user_info;
      $data['main_content'] = 'profile_view';
      $this->load->view('includes/template', $data);  
    }
    else
    {
      //user didn't exist
      show_404();
    }
  }
}
Edit: Remember, once you start using routes, you need to route everything because you are straying away from CI's default setup of requests containing controller/method. Routes go in order from top to bottom. As SOON as a route matches, it will execute that route and ignore anything after. So if you only have 1 route that is a catch-all, everything will go there unless you have a route that matches before the catch-all.


Messages In This Thread
How to display a users personal page from URL - mysite/username - by El Forum - 02-28-2012, 01:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB