We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8741
    • 17 Posts
    For the life of me I cannot find where there is information on how to access parameters on the URL. A simple $_Get won’t retrieve anything. So I’m assuming MODx is grabbing it and storing it somewhere. However, I can’t find documentation for where that is.

    Can someone point me in the right direction? Here’s an example URL:

    http://www.somewhere.com/special/catalog/?desig=123456

    Thanks!
      • 8741
      • 17 Posts
      Not sure what was going on, but $_GET is working now. Oh well. smiley
        • 10789
        • 2 Posts
        Hi, i’m new with modx and i have your same problem.
        I want call snippet with parameter &tpp and value $_GET[’c’], where c is URL parameter
        for example: ( http://localhost/modx-1.0.2/index.php?id=47&c=vita ).

        I call snippet test in this mode: [[test? &tpp=`$_GET[’c’]`]]
        but do not work.

        can you help me?
          • 4310
          • 2,310 Posts
          Here is the simplest snippet example :
          <?php
          $output = '';
          $output .= $_GET['c'];
          return $output;
          ?>
            • 4041
            • 788 Posts
            Using the example link you provided above, try this as yout Test snippet and see if it helps:

            <?php
            /*    testsnippet
                  usage: call uncached
                  [!testsnippet!]
            
            */
            $output ='';
            $tpp = isset($_GET['c']) ? $_GET['c'] : 'tpp not found';
            
            $output .='<p>tpp: '.$tpp.'</p>';
            
            return $output;
            ?>
              xforum
              http://frsbuilders.net (under construction) forum for evolution
              • 10789
              • 2 Posts
              Thank you for your kindness, now work fine smiley
                • 42184
                • 27 Posts
                A slightly different variation on the previous responses:

                <?php
                /**
                 * MY_GetQueryStringValue
                 *
                 * DESCRIPTION
                 *
                 * This snippet returns a value from a query string
                 *
                 * USAGE:
                 *
                 * [[!MY_GetQueryStringValue? &field=``]]
                 */
                
                return isset($_GET[$field]) ? $_GET[$field] : '';
                
                  • 10378
                  • 375 Posts
                  Quote from: simonbingham at Feb 03, 2013, 11:22 PM
                  A slightly different variation on the previous responses:

                  <!--?php
                  /**
                   * MY_GetQueryStringValue
                   *
                   * DESCRIPTION
                   *
                   * This snippet returns a value from a query string
                   *
                   * USAGE:
                   *
                   * [[!MY_GetQueryStringValue? &field=``]]
                   */
                  
                  return isset($_GET[$field]) ? $_GET[$field] : '';
                  
                  -->

                  This doesn't work!

                  It has to be:

                  return isset($_GET['field']) ? $_GET['field'] : '';
                  
                    Freelancer @bitego http://www.bitego.com
                    ---
                    GoodNews - one of the most advanced and integrated Group Mailer premium add-ons for MODX Revolution!
                    More infos here: http://www.bitego.com/extras/goodnews/
                    • 48377
                    • 10 Posts
                    Quote from: breezer at Nov 13, 2009, 12:29 PM
                    Using the example link you provided above, try this as yout Test snippet and see if it helps:

                    <!--?php
                    /*    testsnippet
                          usage: call uncached
                          [!testsnippet!]
                    
                    */
                    $output ='';
                    $tpp = isset($_GET['c']) ? $_GET['c'] : 'tpp not found';
                    
                    $output .='<p-->tpp: '.$tpp.'<p></p>';
                    
                    return $output;
                    ?>

                    Thank you, you saved me from my ignorance with this . smiley