-
Notifications
You must be signed in to change notification settings - Fork 179
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
folder fallback not working as expected for "theming" render/layout #234
Comments
@fkooman this is a great discovery. I think this might do well with a proper theme extension that would allow you to set a theme variable for plates and it'll be used as context when fetching products. So, implicitly ever call to a template file would check for the currently set theme and fallback accordingly. |
How would one go about this? I've been looking at it for a few hours now and I don't really understand how to override the calls to "render" and "layout" from an extension to make it consider the "theme" path... My approach was to try and call setDirectory from the extension to the theme path if the template exists in the theme directory, otherwise do nothing... |
It turns out it is not that difficult to write a more or less compatible Plates implementation that does work with "themes", i.e. allows you to specify a list of folders where it starts looking in the first one and 'falls back' to the later ones... https://gist.github.com/fkooman/6942065e6dd3ad2c540349f3e6dba6f6 |
Good deaal @fkooman will check this out when I get bit more time. Little slammed during holidays |
When I think this through, I wonder if the component system will better tackle this type of issue. I'm going to attach this to the 3.5 milestone for now and see if this something that we can look at then. |
- Added support for themes - Added support for ResolveTemplatePath as a way for more complex path resolutions for templates Signed-off-by: RJ Garcia <ragboyjr@icloud.com>
Theme support has been merged to master! |
I followed the Simple example and tried to add "theming" from the Folders documentation.
It makes the most sense to add
template.php
to thetheme1
folder to point to a different CSS file.However, this does not work. It will try to locate
profile.php
in the/path/to/theme/1
, which fails, so it falls back to the default path where it findsprofile.php
. However,profile.php
contains this call:This again takes the "default"
template.php
instead of the one fromtheme1
. I'd also have to modify the call thelayout
to point totheme1::template
which then does work... But then it is not easily configurable from your controller...So it seems the only way to make this work is to create a "full" theme, i.e. copy all templates in the directory of the theme, except the ones that do not reference other templates... So here I'd need to copy
profile.php
to thetheme1
folder as well, even though only thelayout
call would be different...Is there any other way to make this easier without needing to duplicate templates you don't want to modify in your theme?
The text was updated successfully, but these errors were encountered: