public setLoader ( latte\ILoader $loader ) : static | ||
$loader | latte\ILoader | |
Résultat | static |
/** * @param string $basePath * @param string $tempPath */ public function __construct($basePath, $tempPath = null) { $this->latte = new Engine(); $this->latte->setLoader(new FileLoader()); if ($tempPath) { $this->latte->setTempDirectory($tempPath); } $this->basePath = $basePath; }
/** * @return Engine */ function latte() { $latte = new Engine(); $latte->setLoader(filter('latte.loader', new FileLoader())); $latte->setTempDirectory(\dir\cache()); $latte->addFilter('md', '\\cms\\md'); trigger('latte.macroset', new MacroSet($latte->getCompiler())); return filter('latte', $latte); }
public function testConstructor() { $loader = new FileLoader(); $latte = new Engine(); $latte->setLoader($loader); $engine = new LatteTransformer(array('latte' => $latte)); $actual = $engine->renderFile('tests/Fixtures/template.latte', array('name' => 'Linus')); $this->assertEquals('Hello, Linus!', $actual); }
/** * @return Engine */ function latte() { $latte = new Engine(); $latte->setLoader(filter(FileLoader::class, new FileLoader())); $latte->setTempDirectory(\dir\cache()); $latte->addFilter('md', '\\cms\\md'); trigger(MacroSet::class, new MacroSet($latte->getCompiler())); return filter(Engine::class, $latte); }
/** * {@inheritdoc} */ public function register(ContainerInterface $app) { $app->closure(Engine::class, function () { $engine = new Engine(); $engine->setLoader(new FileLoader()); $cachePath = config('view.cache'); if ($cachePath) { $engine->setTempDirectory(path($cachePath)); } return $engine; }); $app->closure(RenderInterface::class, function ($app) { return new LatteView($app[Engine::class], path(config('view.path'))); }); }
public function createService(ServiceLocatorInterface $serviceLocator) { $engine = new LatteEngine(); $engine->setLoader($serviceLocator->get('latte.loader')); return $engine; }
/** * Render a string * * @param string $template The template content to render * @param array $locals The variable to use in template * @return null|string */ public function render($template, array $locals = array()) { return $this->latte->setLoader($this->stringLoader)->renderToString($template, $locals); }