How to create template specific globals #430
Replies: 4 comments 9 replies
-
Do these templates include each other? Or they're all independent? |
Beta Was this translation helpful? Give feedback.
-
They would include each other. The idea is to have each be attached to its custom data source and that template could be placed inside of numerous other templates without concern about passing variables around. A bit like a dashboard where each template is a widget with its data source. User could still pass variables etc of course. So I could either override the render and other similar tag to auto include this global data or have some kind of hook that is called on variable search (which would need to provide the template name so I know what variables to pass it as "globals" |
Beta Was this translation helpful? Give feedback.
-
Yes the render tag extend is probably easier so I will try that. if I create a new render tag will it override the existing one? |
Beta Was this translation helpful? Give feedback.
-
Register a tag with the same name should replace the previous one. If not
feel free to file a bug.
Except for templates already parsed before replacing. You'll need register
all tags before any parse or render.
|
Beta Was this translation helpful? Give feedback.
-
The scenario is that each partial/template is loaded from a DB with a preset set of variables that are automatically available only for that partial/template. Do you have a suggestion as to what I can override to achieve this?
Beta Was this translation helpful? Give feedback.
All reactions