How to use Texy in Latte template as a filter 01/02/2015
Install Texy via composer and register it as a service in config.neon.
services - Texy Register Texy as a Latte filter in presenter
/** * @var \Texy @inject */ public $texy; protected function createTemplate($class = NULL) { $template = parent::createTemplate($class); // $template->addFilter('texy', callback($this->texy, 'process')); // old php $template->addFilter('texy', array($this->texy, 'process')); return $template; } and use it in Latte file
{$article->content|noescape|texy}
Install Texy via composer and register it as a service in config.neon
.
services
- Texy
Register Texy as a Latte filter in presenter
/**
* @var \Texy @inject
*/
public $texy;
protected function createTemplate($class = NULL) {
$template = parent::createTemplate($class);
// $template->addFilter('texy', callback($this->texy, 'process')); // old php
$template->addFilter('texy', array($this->texy, 'process'));
return $template;
}
and use it in Latte file
{$article->content|noescape|texy}