title: What is the base directory for Zend ViewModel setTemplate?
body: <p>I'm trying to load a different view depending on the value taken from a Regex route, but I can't get the ViewModel to load the template</p>
  
  <pre><code>public function viewAction()
  {
      $page = $this-&gt;params()-&gt;fromRoute()["page"];
  
      $view = new ViewModel();
      $view-&gt;setTemplate('module/Base/view/base/index/$page');
  
      return $view;
  }
  </code></pre>
  
  <p>I'm following the conventional module setup:</p>
  
  <pre><code>Base
  |- config
  |  |- module.config.php
  |- src
  |  |- Base
  |     |- Controller
  |        |- IndexController.php
  |- view
     |- base
     |  |- index
     |     |- index.phtml
     |     |- other.phtml
     |- layout
  </code></pre>
  
  <p>And my view_manager configuration is:</p>
  
  <pre><code>'view_manager' =&gt; array(
      'display_not_found_reason' =&gt; true,
      'display_exceptions'       =&gt; true,
      'doctype'                  =&gt; 'HTML5',
      'not_found_template'       =&gt; 'error/404',
      'exception_template'       =&gt; 'error/index',
      'template_map' =&gt; array(
          'layout/layout'        =&gt; __DIR__ . '/../view/layout/layout.phtml',
          'error/404'            =&gt; __DIR__ . '/../view/error/404.phtml',
          'error/index'          =&gt; __DIR__ . '/../view/error/index.phtml',
      ),
      'template_path_stack' =&gt; array(
          __DIR__ . '/../view',
      ),
  ),
  </code></pre>
  
  <p>I've tried all sort of values in the path passed to setTemplate, but I just keep getting the application error message, but no error log or details (that may be because I haven't figured out displaying errors properly). I have confirmed that <code>$page</code> is getting the name of the template correctly from the URL, and the template is in the correct directory.</p>
  
  <p>So, where does ViewModel start looking for templates?</p>
  
  <p>I've tried:</p>
  
  <pre><code>$view-&gt;setTemplate('$page.phtml');
  $view-&gt;setTemplate('$page');
  $view-&gt;setTemplate('base/index/$page.phtml');
  $view-&gt;setTemplate('base/index/$page');
  $view-&gt;setTemplate('module/Base/view/base/index/$page.phtml');
  $view-&gt;setTemplate('module/Base/view/base/index/$page');
  </code></pre>