tomaj/nette-auto-variable-template

Auto variable template factory

2.2.0 2021-11-12 09:15 UTC

This package is not auto-updated.

Last update: 2024-11-09 19:28:09 UTC


README

Simple library that can assign variables in all latte templates (also components). Usefull when you need variable that will be always in all templates.

Instalation

composer require "tomaj/nette-auto-variable-template"

Usage

In config.neon you need setup factory:

latte.templateFactory: {autowired: no}
templateFactory:
	factory: Tomaj\Latte\AutoVariableTemplateFactory(@latte.templateFactory)
	setup:
		- registerVariable('variableName', @someValue)
		- registerVariable('otherVariable', 'something else')

in each template will be variables {$variableName} and {$otherVariable}