title: MVC URL issues (Codeigniter)
body: <p>I'm building a website using Codeigniter and I really like how in the MVC pattern URLs are used to reference controller methods. It seems very logical and intuitive however, I seem to be running in an array of issues with this very pattern!</p>
  
  <p>So I am building an events website and currently I'm passing everything through one main Site controller, passing a number of parameters:</p>
  
  <pre><code>public function index($page = NULL, $city = NULL, $type_venue = NULL, $slug = NULL)
  {
      // if the page argument is empty show the homepage
      if( ! ($page))
      {
          $page = 'home';
      }
  
      // create an array for passing to the views
      $data = array(
          'title_city' =&gt; $city,
          'title_type_venue' =&gt; str_replace('-', ' ', $type_venue),
          'locations' =&gt; $this-&gt;locations_model-&gt;load(),
          'events' =&gt; $this-&gt;events_model-&gt;load($city, $type_venue, $slug),
          'venues' =&gt; $this-&gt;venues_model-&gt;load($city, $slug)
      );
  
      // construct the page layout with the following views
      $this-&gt;load-&gt;view('partials/head', $data);
      $this-&gt;load-&gt;view('partials/header', $data);
      $this-&gt;load-&gt;view('content/'.$page, $data);
      $this-&gt;load-&gt;view('partials/footer');
  }
  </code></pre>
  
  <p>This works fine, in that it loads content for the following URLs:</p>
  
  <pre><code>site.com/events/bristol/open-mic/city-varieties/another-incredible-event
  site.com/events/bristol/open-mic/city-varieties/
  site.com/events/bristol/open-mic/
  site.com/events/bristol/
  </code></pre>
  
  <p>However if I want to pass anything else through this controller that <em>isn't</em> an event, i.e. register/user, I have to write a specific route for this!</p>
  
  <p>Worth noting my routing is:</p>
  
  <pre><code>$route['(:any)'] = 'site/index/$1';
  </code></pre>
  
  <p>I could write separate controllers for each entity, i.e. events, venues, cities but each one would look largely like the above (correct?) in that each would need the parameters to get the data.</p>
  
  <p>My question is - what is the best practice approach for developing long query strings like this? Is a single controller correct? It doesn't feel like it, but then multiple controllers would violate DRY, just because they all need so much similar data. Any help appreciated!</p>