title: PHP, Smarty: Check for template in different folders
body: <p>for our latest project we used Django, where one can specify a list of folders, that are searched for a template, say, with name <code>example.html</code>. Now, we switched back to <a href="http://smarty.net/" rel="nofollow noreferrer">Smarty</a> (PHP) and are wondering, if there is something similar.</p>
  
  <p>Smarty version: Can be cutting-edge.</p>
  
  <p>Behaviour:</p>
  
  <ol>
  <li>Feed Smarty with an array of folders.</li>
  <li>Call a template either with <code>$smarty-&gt;display()</code> or <code>{include}</code>.</li>
  <li>Smarty searches through the folders and takes the first template matching the name.</li>
  </ol>
  
  <p>I looked at <a href="http://smarty.net/manual/en/template.resources.php" rel="nofollow noreferrer">Smarty resources</a>, but they look like overkill for this task, and the docs are a bit sparse on this topic. Any ideas how this could be done?</p>
  
  <p><em>An additional problem</em> is, that the list of folders may change depending on the requested URL. Any ideas how to tell Smarty, which compiled template to use?</p>
  
  <p>Cheers,</p>