- Just install it as standard symfony bundle
- Then just ask for
Latte\Engine
service
Makes a request to the given route and prints the result.
{renderRoute <routeName>[, 'routeParams'=>[(<key> => <value>,)...][, 'renderOptions'=>[(<key> => <value>,)...]}
{renderRoute myAwesomeRoute,'routeParams'=>['x' => 5, 'y' => 7],'renderOptions'=>['strategy' => 'inline']}
Print the relative URL (without the scheme and host) for the given route.
{routePath <routeName>[,<key> => <value>]...}
<a n:href="<routeName>[,<key> => <value>]...">
{routePath myAwesomeRoute,'x' => 5,'y' => 7}
<a n:href="myAwesomeRoute,'x' => 5,'y' => 7"></a>
Print the absolute URL (with scheme and host) for the given route.
{routeUrl <routeName>[,<key> => <value>]...}
{routeUrl myAwesomeRoute,'x' => 5,'y' => 7}
Returns the relative path from the passed absolute URL. See Symfony doc - relative_path
{relativePath <absoluteUrl>}
{relativePath 'http://example.com/human.txt'}
Returns the absolute URL from the passed relative path.
{absoluteUrl <relativePath>}
{absoluteUrl 'human.txt'}
Renders a CSRF token. Use this function if you want CSRF protection without creating a form.
{csrfToken <intention>}
Generates a absolute/relative logout URL for the given firewall. If no key is provided, the URL is generated for the current firewall the user is logged into.
{logoutPath [key]}
{logoutUrl [key]}
See Symfony docs - translation in templates
{="<translation.key>"|translate[:[(<argumentName> => <argumentValue>,)...]][:<domain>][:<locale>]}
{_"<translation.key>"}
domain
- string, optionallocale
- string, optional
{="my.awesome.translation.key"|translate:['%name%' => 'Karel','%job%' => 'Metař']}
{="my.awesome.translation.key"}
See Symfony docs - translation in templates
{="<translation.key>"|translateChoice:<count>[:[(<argumentName> => <argumentValue>,)...]][:<domain>][:<locale>]}
count
- int, requireddomain
- string, optionallocale
- string, optional
{="my.awesome.translation.key"|translateChoice:5:['%name%' => 'Karel','%job%' => 'Metař']}
- Class
\Mangoweb\LatteBundle\Macro\SimpleMacro
is wrapper for macroSet->addMacro() (see https://latte.nette.org/en/#toc-user-defined-macros) - Extend class and mark service with service tag
- { name: latte.simple_macro }
- Or Implement
\Mangoweb\LatteBundle\Macro\ISimpleMacroProvider
and mark it with service tag- { name: latte.simple_macro_provider }
- Implement directly
\Latte\IMacro
- Register service and mark it with service tag
- { name: latte.advanced_macro, macro_name: fooBar }
- Implement
\Mangoweb\LatteBundle\Filter\IFilterProvider
- Mark service with service tags:
{name: 'latte.filter_provider'}
- Create service and tag it with
- {name: 'latte.provider', provider_name: fooBar }
- This will then be avabile at runtime in latte via
$this->global->fooBar