Skip to content

Instantly share code, notes, and snippets.

@dg
Created May 19, 2014 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dg/b4a2cbe84c80fb73c553 to your computer and use it in GitHub Desktop.
Save dg/b4a2cbe84c80fb73c553 to your computer and use it in GitHub Desktop.
<?php
class FooControl extends Nette\Application\UIControl
{
public function render()
{
MyTemplate::registerFilters($this->template)
->render(__DIR__ . '/control.latte');
}
}
class BarControl extends Nette\Application\UIControl
{
public function render()
{
MyTemplate::registerFilters($this->template)
->render(__DIR__ . '/control.latte');
}
}
class MyTemplate
{
static function registerFilters($template)
{
$template->addFilter('a', ...);
$template->addFilter('b', ...);
$template->addFilter('c', ...);
return $template;
}
}
<?php
class FooControl extends Nette\Application\UIControl
{
public function render()
{
$template = $this->template;
$template->addFilter('a', ...);
$template->addFilter('b', ...);
$template->addFilter('c', ...);
$template->render(__DIR__ . '/control.latte');
}
}
class BarControl extends Nette\Application\UIControl
{
public function render()
{
$template = $this->template;
$template->addFilter('a', ...);
$template->addFilter('b', ...);
$template->addFilter('c', ...);
$template->render(__DIR__ . '/control.latte');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment