title: Magento Custom Router loading controller but nothing else
body: <p>I'm trying to get some custom routing going on in Magento using the following code (which I've only slightly modified from here <a href="https://stackoverflow.com/a/4158571/1069232">https://stackoverflow.com/a/4158571/1069232</a>):</p>
  
  <pre><code>class Company_Modulename_Controller_Router extends Mage_Core_Controller_Varien_Router_Standard {
  
  public function match(Zend_Controller_Request_Http $request){
      $path = explode('/', trim($request-&gt;getPathInfo(), '/'));
      // If path doesn't match your module requirements
      if ($path[1] == 'home.html' || (count($path) &gt; 2 &amp;&amp; $path[0] != 'portfolios')) {
          return false;
      }
      // Define initial values for controller initialization
      $module = $path[0];
      $realModule = 'Company_Modulename';
      $controller = 'index';
      $action = 'index';
      $controllerClassName = $this-&gt;_validateControllerClassName(
          $realModule, 
          $controller
      );
      // If controller was not found
      if (!$controllerClassName) {
          return false; 
      }            
      // Instantiate controller class
      $controllerInstance = Mage::getControllerInstance(
          $controllerClassName, 
          $request, 
          $this-&gt;getFront()-&gt;getResponse()
      );
  
      // If action is not found
      if (!$controllerInstance-&gt;hasAction($action)) { 
          return false;
      }
      // Set request data
      $request-&gt;setModuleName($module);
      $request-&gt;setControllerName($controller);
      $request-&gt;setActionName($action);
      $request-&gt;setControllerModule($realModule);
      // Set your custom request parameter
      $request-&gt;setParam('url_path', $path[1]);
      // dispatch action
      $request-&gt;setDispatched(true);
      $controllerInstance-&gt;dispatch($action);
      // Indicate that our route was dispatched
      return true;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The result is a page where the template has loaded but with no content. If I comment out the $this->loadLayout() / $this->renderLayout() in my controller I can print to screen. But when I try and load a Template and/or Block it breaks somewhere.</p>
  
  <p>home.html also loads fine (as the method returns false if the path is home.html).</p>
  
  <p>Any assistance would be greatly appreciated.</p>