vrestihnat / title-control
Nette control for managing title in HTML header.
1.0.1
2021-01-17 19:18 UTC
Requires
- php: >=7.4.0
- nette/application: ^3.0@dev
- nette/utils: ^3.1.3@dev
Requires (Dev)
- phpunit/phpunit: ^9.5
README
Installation
Via Composer:
$ composer require vrestihnat/title-control
Usage
First register the control factory in your config:
services: - implement: Vrestihnat\TitleControl\ITitleControlFactory
Use the control factory in your presenter:
protected function createComponentTitle(): Vrestihnat\TitleControl\TitleControl { $control = $this->titleControlFactory->create(); $control->setTitle('My title'); return $control; }
And render it in your Latte template:
<html> <head> {control title} </head> <body> ... </body> </html>
We can also use multi title with a separator. Default separator is: ' | '
$control->addItem('One')->addItem('Two'); // 'One | Two'
Change the separator:
$control->setSeparator(' ~ ');
We can also use nette translator