Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • sailor01 Friend
    #962925

    Hello,

    First of all: thank you for providing so many really good templates with the T3 framework. I start to feel comfortable with the framework structure. But I still have a lot to learn. 🙂

    Following the localization guide in http://www.t3-framework.org/documentation/extend-com-content#isolate-template I did customizations to JA MegaStore in the {templatename}/local/ folder and overrides to joomla core files within {templatename}/local/html/ to be template update proof.

    Everything is fine for general files e.g. in subfolders like {templatename}/local/html/com_content/, but I get into trouble with {templatename}/local/html/modules.php as the contents of this file (copy of the ja_megastore contents of {templatename}/html/modules.php plus code adjustments) rises a frontend error:

    Fatal error: Cannot redeclare modChrome_T3Xhtml() (previously declared in (..)/templates/ja_megastore/html/modules.php:34) in (..)/templates/ja_megastore/local/html/modules.php on line 73

    The file priorities (loading sequence, the later overrides the earlier one) is ok, but the philosophy apparently causes an error if you define functions within these files.

    How can this be resolved without manipulating your template files directly (which does work), thus losing update proofness? [ I need to override your functions to have the menu title multilanguage ready, thus include $module->title = JText::_($module->title); in all the functions. – I tried having this as a single line of code in the local variant, but that does not seem to affect the global scope. ]

    Best regards, Sailor

    Saguaros Moderator
    #963162

    Hi Sailor,

    Try to rename this file: {templatename}/html/modules.php so the template will use the override file in local folder.

    But when you update new version template, you will have to rename this file again. This is special file so I’m afraid this is only way to achieve that.

    sailor01 Friend
    #963186

    Hi Saguaros,

    thanks for the reply. That does work for the moment and enables a fast fix. But it is a pity that the system is not update proof in this case, especially if the maintenance is in the hands of the client.

    The resulting error is "fatal", so the page will be definitely broken unless that file is renamed again. – I’d rather loose a title translation than break the site on template update.

    Do you see any way to resolve this conflict permanently?

    Sincere regards, Sailor

    Saguaros Moderator
    #963196

    Hi Sailor,

    I understand your point however, as I mentioned above, this is special file for module rendering, it can’t be inherited like html layout files / CSS or LESS files. So please use our JA Extension Manager component (FREE extension) to update template (or JA products) which can provide you option to make a comparison between current version and updated version, then you will know which files / folders will be updated. We always recommend uses to have this useful step when trying to update new version of our products.

    sailor01 Friend
    #963221

    Hi Saguaros,

    I respect the recommendation (and like the code check option implented within your JA Extension Manager). However this is not dummy-user-proof as it requires a skilled operator / programmer to review the code changes for desired and/or undesired patches.

    The redeclare issue for the special file modules.php rises because the scripts in htmland local/html are loaded in sequence. – Would you instead load this specific file modules.php alternatively?

    Why?

    PATH_TO_JOOMLA/templates/system/html/modules.php defines the basic modChrome functions independent of the template and is usually extended by template specific styles in PATH_TO_JOOMLA/templates/TEMPLATE_NAME/html/modules.php (https://docs.joomla.org/Applying_custom_module_chrome / http://blog.cre8ive4ever.com/2013/05/modchrome-ausgabe-von-joomla-modulen/).

    In T3 Framework the contents of the TEMPLATE_NAME/local/html folder are meant to override the contents of TEMPLATE_NAME/html instead of adding more functions. Thus it is safe to include them alternatively. (Correct me if I am wrong.)

    My suggestion

    In plugins/system/t3/includes/joomla30/modulehelper.php:207: $chromePath = JPATH_THEMES . '/' . $template . '/html/modules.php'; and
    plugins/system/t3/includes/joomla25/modulehelper.php:205: $chromePath = JPATH_THEMES . '/' . $app->getTemplate() . '/html/modules.php';
    change it to

    include_once JPATH_THEMES . '/system/html/modules.php';
    if (file_exists(JPATH_THEMES . '/' . $template . '/local/html/modules.php')) {
        $chromePath = JPATH_THEMES . '/' . $template . '/local/html/modules.php';
    }
    else {
        $chromePath = JPATH_THEMES . '/' . $template . '/html/modules.php';
     }

    respectively in
    plugins/system/t3/t3.php:355: $chromePath = T3Path::getPath('html/modules.php');
    to

    // We don't need chrome multi times - load either local or template default version
    if (file_exists(T3Path::getPath('local/html/modules.php'))) {
        include_once(T3Path::getPath('local/html/modules.php');
    } else {
        $chromePath = T3Path::getPath('html/modules.php');
        if (file_exists($chromePath)) {
            include_once $chromePath;
        }
    }
    • Make sure to skip modules.php when loading the contents of the local folder later.

    (Have I missed anything?)

    What do you think?

    Best regards,
    Sailor

    sailor01 Friend
    #963704

    Hi Saguaros,

    I hope you spent a nice weekend.

    We had been talking about getting your T3 templates update proof with respect to isolation of customizations with special regards to modules.php.

    Let’s extend this to favicon.ico, which is so far not pulled from the local/ folder. In http://www.t3-framework.org/discussions/is-there-really-a-need-for-template-updates-to-overwrite-existing-favicons.html Gardner Luna suggests that it should work like this and a potential failure would be discussed with the dev team (2 years ago), but it does not (yet) work like this by now.
    [Edit: T3 Framework 2.6.1]

    What is your status on that topic?

    BR, Sailor

    Saguaros Moderator
    #964202

    Hi Sailor,

    I got your point but if you change in file in T3 framework plugin, when you update T3 framework, it will be overridden also <<< you must backup this file >>> so why simply backup modules.php when updating template?

    For the favicon, by default, Joomla provides way to override is copy your favicon into template folder. To change the path, you can check the docs here: https://docs.joomla.org/Changing_the_site_favicon

    There are only some special files like this, it’s not too difficult for end user to backup before updating though.

    sailor01 Friend
    #970195

    Dear Saguaros,

    sorry for the late reply (notification for the update was not received/noticed).

    Having a backup of the modules.php is recommended. However if there are multiple administrators or respectively the template setup guy and the customer (to keep it customer-maintained), the backup is easily lost or forgotten. I love the intention of the "local" folder and would like to make use of it as far as possible, that’s why I am bugging you.

    With respect to the favicon.ico: I am fully aware of this standard location and procedure. However: A template update / (re)install from JoomlArt will overwrite any customly replaced favicon.icon in this location. – That’s why I am asking for a "local" folder alternative.

    Best regards,
    Sailor

    Saguaros Moderator
    #970362

    Hi Sailor,

    I got your point, let me pass to the team for further consideration on this.

Viewing 9 posts - 1 through 9 (of 9 total)

This topic contains 8 replies, has 2 voices, and was last updated by  Saguaros 7 years, 6 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum