-
Notifications
You must be signed in to change notification settings - Fork 76
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
Using several themes in the same process #79
Comments
I guess this might also enable referencing a non themed template from the themed template with the same "name" |
it would require defining a specific naming convention for this |
Any update on this as this looks very interesting. |
I also need this functionality, and so took a quick look at implementing it. Apologies if I have missed something, but this seems as though it can be solved relatively simply by using a custom Twig filesystem loader, as stof suggested. This solution does not solve the 'referencing a non-themed template from a themed template' issue. Here's the proof of concept: c501b2d. Please excuse any code formatting issues - if this solution has any legs I'll tidy it up and submit a PR. Suggestions are welcome. |
its always easier to review code in a PR .. so open up the PR and we can discuss. note you can update a PR by simply pushing to your branch as often as you want. |
Done. See #116. Cheers. |
Currently, it is not possible to use the same template in different themes in the same PHP process, because the Twig_Loader_Filesystem caches the resolution of template names to file names in memory.
Fixing this would require replacing the Filesystem loader with a theme-aware version (it would also be required for #50 btw).
My use case for rendering the template in different themes int he same process is background processing: I select the theme based on the user in my app. The background process sending them emails should also use the right theme. But the process can send emails to users with different themes.
Not being able to change the theme is already an issue when doing it in a command, but it becomes even worse when the logic is in a RabbitMQ consumer (as the process is long-running).
As I need it at work, I will look into implementing it.
The text was updated successfully, but these errors were encountered: