title: Setting the Kohana template name dynamically
body: <p>I can't seem to set the <code>$template</code> variable dynamically of a site built on Kohana.</p>
  
  <p>If I extend the Template_Controller class, I can set the template name like this:</p>
  
  <pre><code>public $template = 'template_file_name';
  </code></pre>
  
  <p>But I can't set it dynamically like:</p>
  
  <pre><code>public $template = $this-&gt;setTemplate();
  </code></pre>
  
  <p>or </p>
  
  <pre><code>switch($var):
      default:
         public $template = 'filename';
         break;
  endswitch;
  </code></pre>
  
  <p>Changing the <code>$template</code> variable using <code>$this-&gt;template</code> in the constructor breaks the Template_Controller somehow: </p>
  
  <blockquote>
    <p>Fatal error: Call to a member function render() on a non-object </p>
  </blockquote>
  
  <p>I need to set the template filename based on a variable set in the constructor, or perhaps pulled from an external library.</p>
  
  <p>Any ideas how to make this possible?</p>