Exemplo n.º 1
0
 public function findTemplate($name, $dirs = null)
 {
     /** @var $loader Closure */
     foreach ($this->loaders() as $loader) {
         try {
             list($template, $display_name) = $loader($name, $dirs);
             return array($template, DjaLoader::makeOrigin($display_name, $loader, $name, $dirs));
         } catch (TemplateDoesNotExist $e) {
             continue;
         }
     }
     throw new TemplateDoesNotExist($name);
 }
Exemplo n.º 2
0
 public function loadTemplate($template_name, $template_dirs = null)
 {
     list($source, $display_name) = $this->loadTemplateSource($template_name, $template_dirs);
     $origin = DjaLoader::makeOrigin($display_name, py_getattr($this, 'loadTemplateSource'), $template_name, $template_dirs);
     try {
         $template = DjaLoader::getTemplateFromString($source, $origin, $template_name);
         return array($template, null);
     } catch (TemplateDoesNotExist $e) {
         /*
          * If compiling the template we found raises TemplateDoesNotExist, back off to
          * returning the source and display name for the template we were asked to load.
          * This allows for correct identification (later) of the actual template that does not exist.
          */
         return array($source, $display_name);
     }
 }