We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14102
    • 7 Posts
    I am assuming that "you can use a chunk to customize ANY view" in the docs means that you can replace all the internal templates (webloginpe.templates.php) can be replaced by chunks. So...

    How are the WebloginPE chunks supposed to be named?

    Is there a naming convention? I first assumed that if a properly named chunk was found, it would be used instead of the stuff in webloginpe.templates.php. But it does not make sense to load the whole of webloginpe.templates.php only to use chunks instead. So I am assuming now that in webloginpe.templates.php, you replace the template data by the name of the chunk as in:

    $wlpeDefaultFormTpl=’{{chunk_name}}’;


    This does not work either, mostly because in the order of events, the chunks are evaluated first, I assume. So what is the answer? How do I replace the data loaded from the file webloginpe.templates.php with chunks?

    I did not find anything in the docs or on the web. Apologies if this has already been answered. kiss

    JG
    • No, you name your chunk whatever you want, then specify to use that chunk in the snippet call’s parameters.

      See the "Views" section (or the views.html page) in the docs that come with the zip archive. For example,
      [!WebLoginPE? &messageTpl=`messageChunk` &loginFormTpl=`loginformChunk`!]
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 14102
        • 7 Posts
        OK, that answers my question. Thanks for taking the time to answer. I was being too clever for my own good. It made sense to have all chunks either named by convention or specified in an include file. I’m not a big fan of lengthy and fiddly parameters. Maybe I will dig into the code and suggest an improvement.

        It’s a great snippet but its current complexity level (which may not have been foreseen at the start of the project) warrants something like a configuration file. In any case, the way it has been conceived, written and documented is a credit to its author.

        Cheers,

        JG
        • Several of the more complex snippets now can use a configuration file. It’s as simple as including the configuration file at the beginning of the snippet code, and setting the parameters in the configuration file with $paramName = ’...’ instead of &paramName=`...`. The path to the config file can be the only parameter in the snippet call, that way you can have the snippet use different config files under different circumstances.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org