Overwrite view with theme: can't find where

  • Hey


    I want to find the implementation of following feature in pagekit code, but cannot find it anywhere:


    If I add my-theme/views/system/site/page.php it overwrites without any further code the default page template of pagekit. The same you can do with blog views.


    My goal is to find that piece of code in pagekit source, as I want to know, if I can adapt it and if it applies also for extensions.


    Any help appreciated.

    SAB

    The LORD is my strength and my shield; in him my heart trusts, and I am helped; my heart exults, and with my song I give thanks to him. Psalm 28,7

  • Hey sab, if the extension has a clean code it works same wame with the override. Blog extension is best example as every yootheme template has an override for this extension.


    Unfortunately I don't know where it is exactly implemented, but it's working. Similar feature, even way more logical is possible in october cms, you can easy override default templating of each extension and be upgrade safe! This is just a phenomenal feature.


    Regards


    Fossy

  • Hey, finally found it :D

    Now things are clear to me. The view shortcut now make sense!


    In an extension, you should render all templates with {extension-name}{/path/to/template.php}. Following this convention, you make it possible, the theme can overwrite this template with the appropriate folder structure views/{extension-name}{/path/to/overwrite.php}.


    You can only overwrite this views from a theme, as the view: shortcut always directs to views folder of the activated theme. (Similar to theme: which points to the theme root, depending if you are in backend or frontend as they also used different themes)


    I did now about the shortcut, but did not actually know, why they used implemented it that way ... now I know, it was because of the overwriting thing.


    Cheers,

    SAB

    The LORD is my strength and my shield; in him my heart trusts, and I am helped; my heart exults, and with my song I give thanks to him. Psalm 28,7