Beispiel #1
0
 /**
  * @param string          $template file
  * @param TemplateFactory $tf Template Factory - is needed!
  * @throws InvalidArgumentException Thrown when parameter combination does not match
  * @throws FileNotFoundException Thrown when path to the file is nonexistent or the file is not readable
  */
 public function __construct($template, TemplateFactory $tf)
 {
     $this->template = NULL;
     if (is_string($template) && !file_exists($template) && file_exists(__DIR__ . '/' . $template)) {
         $template = __DIR__ . '/' . $template;
     }
     // Check & init
     if (!file_exists($template)) {
         throw new InvalidArgumentException('$template has to be either path to template or instance of \\Nette\\Templating\\ITemplate');
     }
     $this->template = $tf->createTemplate();
     $this->template->setFile($template);
 }