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? ¶m=`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? ¶m=`hotel`]]` &field=`pagetitle`]]