Povilas [!] This is a big one. Starting now XtGem supports GET arguments.

GET arguments are pased like this:
http://example.com/file?argument1=value1&arg2=value2&foo=bar
This will define variables 'argument1', 'arg2' and 'foo'.

Basic syntax in XtGem is:
{_$argumentname}
This can be added to any WML or xHTML file as text, code, etc. You can even add it as, say, image description or link url.

So, for example, if you add this text to your site:
Hello, {_$name}
you can invite a friend to visit your site via example.com/?name=Friend (example.com being your XtGem site URL. Note that if no filename is specified before '?', 'index' will be opened)
and text Hello, Friend will be displayed.

However, if value is undefined, variable code will be left intact. You may want to display some other default value in this case. This can be done by adding '|' and default value right after the variable name.
Examples:
{_$argumentname|undefined} - will display 'undefined' if 'argumentname' is not passed.
{_$argumentname|} - null (empty) text will be output if 'argumentname' is not defined.

Here's our previous example with an added default value:
Welcome to my site, {_$name|guest}

You can also pass user input via GET values using HTML forms or WML anchor tags.
Here's a simple example using HTML form element:
[code]
<form action=„start.html“ method=„GET“>
Enter your name:<br/>
<input name=„name“ value=„guest“ /><br/>
<input type=„submit“ value=„OK“ />
</form>
[/code]
This code will display an input which will allow user to enter his name. After user clicks 'OK' button he will be redirected to start.html and 'name' variable will be added to the URL.

Advanced users will be happy to know that GET arguments are parsed before XT tags. This means that you can use them as arguments inside XT tags.
For example you can use 'include' XT function like this:
[code]<xt id=„include“ file=„/includes/{_$nav|default}“ />[/code]
You then add 'nav' argument to the URL and specify which file you want to include. This is very useful if you want to implement dropdown-based navigation in your site or streamline your site code using includes.

There are countless ways to use GET arguments. If you can come up with an unique use for them, let us know!

Update 09/11/06
GET arguments are not solely 'GET' arguments anymore as they can now be passed through POST aswell.
Also, 'sid' and 'sessid' argument names are reserved and will not be passed.
09 04 23 - 17:43:08 (edited 09 11 05 - 23:48:45) ( )