Skip to content

folder fallback not working as expected for "theming" render/layout #234

@ghost

Description

I followed the Simple example and tried to add "theming" from the Folders documentation.

It makes the most sense to add template.php to the theme1 folder to point to a different CSS file.

$templates->addFolder('theme1', '/path/to/theme/1', true);
echo $templates->render('theme1::profile', ['name' => 'Jonathan']);

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 finds profile.php. However, profile.php contains this call:

<?php $this->layout('template', ['title' => 'User Profile']) ?>

This again takes the "default" template.php instead of the one from theme1. I'd also have to modify the call the layout to point to theme1::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 the theme1 folder as well, even though only the layout 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions