-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Support for multiple paths #314
Comments
I'd consider a more abstracted solution to this. (It introduces a breaking change so it's not anything for the short term, but may be considered for Latte v4.) In my mind the For example, it would make it near trivial to write a wrapper loader which walks through a list of loaders like this: Something like this is not really possible today (without relying on |
@loilo It is already possible to implement a stack loader without BC breaks. Currently you need to catch the The target of a namespace is another one, it is not about fallback mechanism. It is about loading template from completely different directories and not some kind of fallback mechanism. |
That's what I described above, it's just a lot of overhead because a template will possibly be rendered with the need for its actual content.
I should've read your original issue more carefully, sorry for chiming in like that with only partly related content. My stack loader use case originated from a "multiple paths file loader" approach as well, but did not consider your alias approach properly. Sorry again. |
@loilo I think a Example Symfony allows to overwrite any Bundle templates via a special directory e.g.: So in that case it would be something like So a StackLoader and a MultiPath/Namespace Loader make sense. I just would not mix them both into the same class as the target different behaviour. |
Currently Latte does only provide a
FileLoader
which allows to bind templates to a single directory.I think it would be great if Latte would provide additional Loader which allows to register multiple directories via a namespace. So Latte could example use in Laminas Framework as Renderer also by multiple Modules which could registering additional paths.
In twig example the loader accepts multiple paths and the loader will then look one after the other directory.
Another possibility in twig is a namespace example I can have
@app/test.html.twig
and@other/test.html.twig
and register paths like:While in
twig
the@
symbol is used, I found while working on my abstraction that other frameworks use the::
syntax for this e.g.other::blade
.A implementation could look like the following:
MultiPathLoader.php
What do you think about this. Is this a Loader which you think make sense to live inside Latte Core and you are open for a pull request for it?
The text was updated successfully, but these errors were encountered: