We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    Add this code to the very beginning of the snippet code in the Manager, immediately after the introductory comments section:
    /* Add config file capability - sottwell Aug 2009 */
             $config = isset($config) ? $config : 'default';
              if(file_exists(MODX_BASE_PATH . 'assets/snippets/webloginpe/configs/' . $config . '.config.php')) {
                  include MODX_BASE_PATH . 'assets/snippets/webloginpe/configs/' . $config . '.config.php';
             }
    /* end of config addition */
    

    Create a default.config.php file like this:
    <?php
    // default config file for WebLoginPE
    // use this format: $parameter = 'value';
    
    

    and put it in the assets/snippets/webloginpe/configs/ directory.
    Create as many whatever.config.php files as you need, such as reg.config.php:
    <?php
    // config file for registration form
    
    $type='register';
    $registerTpl='wlpeRegister';
    $regRequired='email,username,password';
    $customTable='client_attributes'; 
    $groups='clients';
    $notify='[email protected],[email protected]';
    $notifyTpl='wlpeNotifyTpl';
    $registerSuccessTpl='wlpeRegSuccess';
    $customFields='firstname,lastname,companyname,title';

    And use this snippet call:
    [!WebLoginPE?config=`reg`!]

    Now your snippet calls are much cleaner, you can use ? = & in the parameter values if you need to, the list of parameters is much easier to see at a glance, much less likely to get trashed by accident, and TinyMCE can’t mess up your parameter delimiters. Even move the templates out of chunks directly into the config file!

    Oh, and you can use MODx API functions (or any other PHP code) to make conditional parameters and/or values, too.
      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
      • 4310
      • 2,310 Posts
      Great idea Susan.
      Are you going to add it to the updated version on Google code?
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        No. Feel free to do so if you wish.
          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
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Well, I’m trying to submit it; stuck on the "branch" bit...

          Ok, I think I got it.
            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