latte
latte copied to clipboard
Add namespace loader
- bug fix / new feature? #314
- BC break? no
- doc PR: nette/docs#???
This introduce a namespace loader. This allows to use a namespace like app:: similar to Plates and Blade template engine.
Usage:
$defaultLoader = new FileLoader(__DIR__ . '/templates');
$emailLoader = new FileLoader(__DIR__ . '/emails');
$someLoader = new FileLoader(__DIR__ . '/vendor/some/some/templates');
$otherLoader = new StringLoader(['main' => 'othercontent']);
$loader = new NamespaceLoader([
'' => $defaultLoader,
'email' => $emailLoader,
'some' => $someLoader,
'other' => $otherLoader,
]);
This way it is very flexible as we can use any loader again.
@dg looks like you rebased it. Do I need to change the target branch?
Edit: Oh my fault looks like the master was force pushed to another state. I will rebase my branch.
It looks like @dg has been rebasing this diligently for 2 years. I am also very interested in this feature (the thing I'm trying to do right now likely won't really work without it), as currently there seems to be no way to reference a layout that is not in the same directory as the template, or else have relative paths defined in the {layout} block (ew).
Is there something we users could do to help move this forward, or get attention on it?