public function renderTemplate($filename, $vars = [], $templateDir = '/templates/')
    {
        $filePath = __DIR__ . $templateDir . $filename;
        if (!file_exists($filePath)) {
            // try with '.php' at the end
            $filePath = $filePath . '.php';
            if (!file_exists($filePath)) {
                throw new \InvalidArgumentException(sprintf('Template "%s" not found in "%s" directory', $filename, __DIR__ . $templateDir));
            }
        }
        $template = new PropelTemplate();
        $template->setTemplateFile($filePath);
        $vars = array_merge($vars, ['behavior' => $this]);

        return $template->render($vars);
    }
public function renderTemplate($filename, $vars = [], $templateDir = '/templates/')
    {
        $filePath = __DIR__ . $templateDir . $filename;
        if (!file_exists($filePath)) {
            // try with '.php' at the end
            $filePath = $filePath . '.php';
            if (!file_exists($filePath)) {
                throw new \InvalidArgumentException(sprintf('Template "%s" not found in "%s" directory', $filename, __DIR__ . $templateDir));
            }
        }
        $template = new PropelTemplate();
        $template->setTemplateFile($filePath);
        $vars = array_merge($vars, ['behavior' => $this]);

        return $template->render($vars);
    }
public function renderTemplate ( $ filename , $ vars = [ ] , $ templateDir = '/templates/' ) { $ filePath = __DIR__ . $ templateDir . $ filename ; if ( ! file_exists ( $ filePath ) ) { // try with '.php' at the end $ filePath = $ filePath . '.php' ; if ( ! file_exists ( $ filePath ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Template "%s" not found in "%s" directory' , $ filename , __DIR__ . $ templateDir ) ) ; } } $ template = new PropelTemplate ( ) ; $ template -> setTemplateFile ( $ filePath ) ; $ vars = array_merge ( $ vars , [ 'behavior' => $ this ] ) ; return $ template -> render ( $ vars ) ; }
Use Propel simple templating system to render a PHP file using variables
passed as arguments. The template file name is relative to the behavior's
directory name.

@param  string $filename
@param  array  $vars
@param  string $templateDir
@return string
Use Propel simple templating system to render a PHP file using variables passed as arguments . The template file name is relative to the behavior s directory name .