Command Explanation
All pages rendered on the system use UDB commands to insert different elements on to the page.
For example, if you want to put the page title onto a template then you can insert the command {PAGE_TITLE}. This will be replaced with the current page title whatever page is being displayed.
If you want to add a link to a another page on the system then you can add {LINK(1013, Contact)}. This will create a link to the page number 1013 and add the text "Contact" (Contact).
All of the commands need to be enclosed in { } when used on the page and the command needs to be entered in upper case. They may also have parameters. These are enclosed in ( ). Most of the time it is easier to enter the parameters by position separated by commas. So in the LINK example above, the first parameter is the Object ID of the page you want to link to and the second parameter is the text you want to be displayed on the page. Sometimes there may be a larger number of parameter options and using lots of commas to get to the correct parameter can be awkward and confusing to read. In this case, you can use a JSON list of parameters. So for the example above, you can use {LINK(1013, {"text":"Contact","class":"btn btn-primary"})}. The JSON list of parameters can only be used as the last parameter. A list of all the parameters are detailed in the command help.
You can also pass in an array of parameters using an array variable. To do this add a JSON parameter "param_array":"V_ARRAY". All the values in the V_ARRAY variable will be used as parameters.
When adding an Object ID as a parameter, it is a good idea to precede it with "#:". This helps the system to identify the number as an Object ID. This is essential if you are writing an application to be shared by other organisations as the Object IDs will need to be changed by the system when they import your application. So the example above, should be written {LINK(#:1013, Contact)}. See OBJ_ID for more info.
If a parameter includes a comma it must be quoted {LINK(1013, "Contact John Doe or, a member of the team")}. If the parameter includes quotes and commas, quotes are escaped with another quote {LINK(1013, "Contact John ""The Man"" Doe or, a member of the team")}.
Parameter values are individually interpreted before they are passed to the command for processing. This can be prevented by preceeding the parameter value with two exclamation marks!!
See below for a full list of commands and their explanations.
Name | Description | Structure |
---|---|---|
COMMA | Returns a comma , | {COMMA} |
DQUOTE | Returns a double quote " | {DQUOTE} |
FIRST_LINE | Return the first line from some text such as an address | {FIRST_LINE(string)} |
FORMAT_DATE | Format a date using the php date() function | {FORMAT_DATE(format, date, date_format)} |
FORMAT_NUM | Format a number | {FORMAT_NUM(number, dec, tot_id)} |
HTML_SPECIAL_CHARS | Converts any HTML special characters to their HTML code | {HTML_SPECIAL_CHARS(string)} |
HTML_TO_TEXT | Convert HTML to either plain text or Markdown | {HTML_TO_TEXT(string)} |
MAIN_PAGE | Indicates the location of the Page Content within a Main or Sub Template | {MAIN_PAGE} |
NALB | No Automatic Line Break | {NALB(string)} |
OBJ_COLOR | Return an objects colour as hex string preceded by a # | {OBJ_COLOR(obj_id, default)} |
ORDINAL | Adds the appropriate ordinal suffix to a number | {ORDINAL(number)} |
PAGE_CONTENT | Indicates the place to insert the page content within the Site Template | {PAGE_CONTENT} |
PAGE_CSS | Indicates the place to insert the page CSS within the Site Template | {PAGE_CSS} |
PAGE_FAVICON | Indicates the place to insert the Domain FaviCon within the Site Template | {PAGE_FAVICON} |
PAGE_JS | Indicates the place to insert the page JavaScript within the Site Template | {PAGE_JS} |
PLURAL | Pluralise a string | {PLURAL(quantity, word)} |
QR_CODE | Display a QR Code containing the provided data | {QR_CODE(data)} |
RETURN_TIDY | Tidy the output returned by the script. | {RETURN_TIDY(options)} |
STRTOTIME | PHP strtotime function | {STRTOTIME(time, now)} |
TAG | Create an HTML Tag | {TAG} |
TEXT_TO_HTML | Text to HTML Conversion | {TEXT_TO_HTML(string)} |
URL_ENCODE | Encode a URL parameter string for sending in a URL | {URL_ENCODE(text)} |
VAR_TIDY | Tidy an existing variable. | {VAR_TIDY(name, options)} |
VERTICAL | Return a character string adjusted to be displayed vertically down the page | {VERTICAL(text)} |