Multiple templates directories

Thanks @asmecher! Lot’s of changes there!

Regarding what you said, I’ve been searching for a solution and it seems recompiles should be correctly triggered by template file modifications if there’s a compile_id assigned. And I think I’ve found the code I needed here: framework/Smarty.php at master · joestump/framework · GitHub

So, added to the changes mentioned before, I’ve changed the fetch function this way:

  • Line 283 changed to:
function fetch($resource_name, $cache_id = null, $compile_id = '', $display = false)
  • Added new line before returning this function:
$compile_id = $this->getCompileID($resource_name, $compile_id);

And I added a new function:


 private function getCompileID($template, $compile_id)
    {
        if (strlen($compile_id)) {
            return $compile_id;
        }
        $compile_id = $this->template_dir . $template;
        return sha1($compile_id);
    }

Don’t know if this solves anything at all, but everything seems to work well right now. I’m going to continue with the tests and I’ll let you know if I find any issue.

Thanks again Alec!
Cheers,
Andy

1 Like