We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32473
    • 10 Posts
    Want to make a variable in snippet, so i can change it’s instance.
    [*variable*] won’t work..
    see example:
    ##################################
    include("db.php");
    include("properties.php");
    $StartSupergroep = ’35’;
    ####################################
    I want to make StartSupergroup variable so i can change it, if i call the snippet in a document.

    Anybody suggestions??
    Thanks
    Wim
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You can simply put &StartSupergroep=`35` in the snippet tags, this will automatically get parsed into a variable $StartSupergroep in the snippet code. Usually you’ll check for the value and set a default if it’s not set:
      $StartSupergroep = isset($StartSupergroep)? $StartSupergroep : 35;

      You can use TVs and other snippets to set it dynamically in your snippet tags.
      [!MySnippet? &StartSupergroep=`[*tv-value*]`!]
        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
        • 32473
        • 10 Posts
        issue solved..
        thanks for quick response..

        closing topic

        This discussion is closed to further replies. Keep calm and carry on.