We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18830
    • 161 Posts
    This snippet will help you to get parameters from an URL.

    I´m no PHP-coder so it would be nice if somebody could check the code for security reasons.

    <?php
    /*
    
    ==================================
    	GetUrlParam Snippet
    =================================
    
    <strong>0.1.</strong> Returns the value of a parameter from an URL as integer
    
    Author: Thomas Steinberg (Mazso)
    Version: 0.1 
    for MODx version 0.95+ 
    Date of release: 2007-12-22
    License: GNU General Public License (GPL) (http://www.gnu.org/copyleft/gpl.html)
    
    ----------------------------------
    	Installation
    
    
    In the MODx manager, go to Resources > Snippets and create new snippet. Name it "GetUrlParam", copy and paste the content of the snippet and save it
    
    ----------------------------------
    	Parameter
    
    $param [ string ]
    Name of the parameter
    __________________________________
    	Snippet call
    
    [[GetUrlParam? &param=`your parameter`]]
    
    
    */
    
    $gupId=' ';
    $gupId = isset($param) ? $param : '0';
    $gupId=$_GET[$gupId];
    settype($gupId, "integer");
    return $gupId;
    unset ($gupId);
    ?>
    



    You can use it in situations like this:


    hotels (id: 12)
    hotel1 (13)
    hotel2 (15)
    hotel (18)
    conferences (5)
    conference1 (22)
    conference2 (24)
    conference3 (25)
    orderform (30)

    Let´s say "conference1" will be held at hotel1. You can use a TV [*hotel*] at your conference-template with a @binding to choose hotel1 from the list of hotels. Now you can pass the ID of the hotel to the orderform writing a link like /orderform?id=[*hotel*].

    If the name of the hotel is stored at the pagetitle you can call in the order form with:

    [[GetField? &docid=`[[GetUrlParam? &param=`hotel`]]` &field=`pagetitle`]]
    


      • 19164
      • 1,215 Posts
      There is a great plugin PHx and its different modifiers. Like this [*phx:get=`hotel`*]
        DirectResize 0.9 beta. PHPThumb, sets of configurations, configuration, binded to specific path. No backward compatibility. | DirectResize 0.9. PHPThumb, наборы параметров, параметры, привязанные к определенным путям. Без обратной совместимости.

        Unfortunately, DirectResize project is closed. If you want to continue development, PM me for access to project page on Google Code. К сожалению, проект DirectResize закрыт. Если вы желаете продолжить разработки, обращайтесь через ПМ для получения доступа к репозиторию на Google Code.

        [PLUGIN] DirectResize - as Maxigallery but for single images :: Download :: [url=http://modxcms.com/forums/index.php/topic,21490]
        • 18830
        • 161 Posts
        Oups. I overlooked this PHx modifier. Thanks, Metaller.