6 * Resource Implementation modifying the extends-Resource to walk
7 * through the template_dirs and inherit all templates of the same name
9 * @package Resource-examples
12 class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends {
15 * populate Source Object with meta data from Resource
17 * @param Smarty_Template_Source $source source object
18 * @param Smarty_Internal_Template $_template template object
21 public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
26 foreach ($_template->smarty->getTemplateDir() as $key => $directory) {
28 $s = Smarty_Resource::source(null, $source->smarty, '[' . $key . ']' . $source->name );
32 $sources[$s->uid] = $s;
35 catch (SmartyException $e) {}
39 $source->exists = false;
40 $source->template = $_template;
44 $sources = array_reverse($sources, true);
46 $s = current($sources);
48 $source->components = $sources;
49 $source->filepath = $s->filepath;
50 $source->uid = sha1($uid);
51 $source->exists = $exists;
52 if ($_template && $_template->smarty->compile_check) {
53 $source->timestamp = $s->timestamp;
55 // need the template at getContent()
56 $source->template = $_template;