title: Thoughts about Subcategory Routing
body: <p>I'm building a basic routing system in order to get rid of the index.php?page_id=2 stuff and use nicely formed URL like:
  news/regional/sports/baseball/junior-league/2010
  which, for example, would take me to the baseball news of the junior league in 2010</p>
  
  <p>The basic structure is like this: there is a router that evaluates the url and accesses an appropriate controller and calls a method with some (optional) arguments. The controller then calls the appropriate model class and binds it to a view which is then outputted.</p>
  
  <p>Taking the previous example, I'd like to access:
  news/regional/sports/baseball/junior-league/2010
  which I'd like to call the BaseballController::view(junior-league, 2010) method. </p>
  
  <p>I'd like to keep the approach modular, so without defining (site-)specific routes. I'd just like to have a pattern in my URLs so that I can call the method of the right controller with the right arguments.</p>
  
  <p>How can I format my URLs and specify some evaluation rules, so that this behavior is obtained? (Is this possible?) </p>
  
  <p>Solutions I've thought of:</p>
  
  <ul>
  <li>Example url: news/regional/sports/baseball/view/junior-league/2010
  <ol>
  <li>explode on the slashes (resulting in an array) </li>
  <li>look for an array[0] controller with a method array[1] </li>
  <li>If that method exists, then call it with the arguments </li>
  <li>If it doesn't, look for an array[1] controller with an array[2] method</li>
  <li>etc<br>
  Advantage is that this approach is very modular. Only thing is that the time to access a page gets longer depending on the number of subcategories there are (or is this neglectable?). Maybe the process can be sped up by storing a site map (but thats just what I don't want)</li>
  </ol></li>
  <li>Format a url like this: [path to controller]/[controller]/[action]-[argument1]-[argument2]
  Example: news/regional/sports/baseball/view-junior_league-2010 using this algorithm
  <ol>
  <li>strip at the "-" (which generates an array) [news/regional/sports/baseball/view, junior_league, 2010]</li>
  <li>take the first elem and explode on the slashes [ [news, regional, sports, baseball, view], junior_league, 2010]</li>
  <li>search for a method named array[0][last] (view) in the controller array[0][last-1] (baseball) which is in the directory controllers/news/regional/sports. Use the rest of the array as arguments.<br>
  Disadvantage is that you also use the underscore and the url is not very nice anymore. And maybe it is little time-consuming?</li>
  </ol></li>
  </ul>
  
  <p>If you've read through all of this, thanks! Maybe you can share your thoughts?
  Gr Bastiaan</p>