title: Best design of member controller using Codeigniter
body: <p>I am using Codeignter and I am looking for input on the design of my members/users control panel.</p>
  
  <p>I currently have my route as</p>
  
  <pre><code>$route['member/(.+)'] = "member/index/$1";
  </code></pre>
  
  <p>And my member controller as </p>
  
  <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  
  class Member extends MY_Controller {
  
  public $userid = '';
  
  function __construct()
  {
      parent::__construct();
      $this-&gt;userid = $this-&gt;uri-&gt;segment(2);
  }
  
  function index()
  {
      $this-&gt;display();   
  }
  </code></pre>
  
  <p>The user ID should always be URI segment 2 or else I redirect to 404. The default page in the control panel is the profile page. I have 3 different areas in the control panel which are profile, settings and privacy. Users can display and edit data in these areas.</p>
  
  <p>I have methods for display_profile, edit_profile, display_settings, edit_settings, etc. I am not sure if I should always evaluate the URL in my index or constructor and then call the correct method or some other design. Any input is appreciated.</p>
  
  <p>The way it is currently designed, the user can be on a page, profile for example and click the settings link and the URL is member/1234/settings. Then if they click the edit button on the settings page, the URL is member/1234/settings/edit and the method edit_settings is called. Is this a good design?</p>