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

[eluser]benners[/eluser]
If I have this as my routes.php

$route['default_controller'] = 'login';
$route['(.*)'] = 'login/$1';


And this _remap
Code:
public function _remap($method, $params = array())
{
  $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 {
   show_404();
  }
}

User URL works but all other URLS give 404.

------

If I try this routes.php
$route['default_controller'] = 'login';

And this _remap

Code:
public function _remap($method, $params = array())
{
  if (method_exists($this, $method)) {
   echo $method;
   print_r($params);
   return call_user_func_array(array($this, $method), $params);
  } else {
   $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 {
    show_404();
   }
  }
}
All URLs work except user which gives 404.

I seem to be going round in circles. Please put me out of my misery!


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



Theme © iAndrew 2016 - Forum software by © MyBB