Shortcut URLs
A shortcut URL may contain placeholders. This page is about them.
Example
Consider for instance the URL of the Google shortcut:
https://www.google.com/search?hl={$language}&q={%query}&ie=utf-8
It contains 2 placeholders: {%query}
and {$language}
.
Placeholders
Example | Will be replaced with | Available |
---|---|---|
Placeholders for arguments |
||
{%foobar} |
argument from query. If there is more than one argument placeholder, their order in URL also defines the expected order in the shortcut query. |
always |
{%foobar|encoding=iso-8859-1} |
... with encoding specified. See Input encoding below. |
always |
{%Datum|type=date|output=Y-m-d}
{%Ziel|type=city} |
... with a specified type. See Argument types below. |
always |
{%IATA-Code|transform=uppercase} |
... with a transformation definition. See Transforming below. |
always |
Placeholders for variables |
||
{$language} |
current language namespace | always |
{$user:name} |
name of current user | only when calling via https://www.findfind.it/u/[username] |
{$now|output=Y-m-d} |
current date and time, attribute output defines the output format which must be based on PHP's date() format. Default is Y-m-d . |
always |
Input encoding
The input encoding, like in {%foobar|encoding=iso-8859-1}
, defines in which way the user arguments shall be encoded before they replace the placeholders {%foobar}
. Defaults to UTF-8.
Input encoding | Passed through functions | Example input | Example output |
---|---|---|---|
UTF-8 | mb_convert_encoding() → rawurlencode() | foo ä bar/ | foo%20ä%20bar%2F |
ISO-8859-1 | foo%20%E4%20bar%2F | ||
... or any of the supported encodings | |||
none | – | http://example.com/ | http://example.com/ |
Argument types
If an argument type is specified, like in {%foo|type=city}
the argument will be processed according to the type.
Type | Conversion | Example input | Example output | Explanation |
---|---|---|---|---|
date | The input will be parsed as a date.
|
7.6. |
2015-06-07 | assumes German format |
7/6 | 2015-07-06 | assumes American format | ||
7 | 2015-06-07 | assumes current month & year | ||
1 | 2015-07-01 | enforced future date: increases month and even year if computed date would be in past otherwise | ||
+10 | 2015-06-17 | today plus 10 days | ||
-5 | 2015-06-02 | today minus 5 days | ||
mo | 2015-06-08 | next Monday | ||
time | The input will be parsed as a time.
|
11.00 |
11:00 | Hours and minutes |
11 | 11:00 | only hour given | ||
+2 | 13:00 | 2 hours from now | ||
city | The input will be parsed as an abbreviation for a city, according to these mappings.
|
b |
Berlin | if current country namespace is deu (Germany) |
at.w |
Wien | forcing an Austrian city | ||
aut.w |
Wien | forcing an Austrian city |
Transforming
Finally, with {%foo|transform=uppercase}
the output string can be transformed.
Property | Conversion | Example input | Example output | Explanation |
---|---|---|---|---|
uppercase | The output will be uppercased. | sxf |
SXF |
Makes sure all letters are uppercase. Using PHP's mb_strtoupper(). |
lowercase | The output will be lowercased. | Sxf |
sxf |
Makes sure all letters are lowercase. Using PHP's mb_strtolower(). |