This component supports selected PHP functions in the application templates.
It allows the template developer to process strings and numbers using native PHP functions such as
strlen, htmlspecialchars, number_format, and stripslashes.
For a complete list of the supported functions, please see below.
The above will display the integer 1234567 formatted into 1,000's, with 2 significant digits shown after the decimal. The result: 1,234,567.00
Name | Required | Default | Description |
---|
escape | Optional | | This will convert special characters to HTML entities: i.e. converting <a> to |
html_entity_decode | Optional | | This will convert all HTML entities to their applicable characters |
htmlentities | Optional | | This will convert all applicable characters to HTML entities |
htmlspecialchars | Optional | | This will convert special characters to HTML entities |
htmlspecialchars_decode | Optional | | This will convert HTML entities back to special characters: i.e. converting <a> to &lt;a&gt; |
jsonencode | Optional | | Creates json safe text, also supports 'dontquote' parameter that will return json safe string without surrounding quotes |
mode | Optional | sanitize | Whether to sanitize or escape the content. Valid values are "sanitize" and "escape". |
money_format | Optional | | This will format a number as a currency string, with 2 decimal places: i.e: $10 |
nl2br | Optional | | Inserts HTML line breaks before all newlines in a string. (This will convert all newlines to html <br/> ) |
number_format | Optional | | This will format a number with grouped thousands: i.e. 1,234,567 There is an optional second parameter for this function: it is decimals (integer). Passing 'decimals' sets the number of decimal places to be shown after the decimal point. So if decimals="2" is passed in the example above, then the result would be: 1,234,567.00 Default: If the value for decimals is not passed, then the default is 0 |
removelinebreaks | Optional | | This will make remove any line breaks in a string |
rtrim | Optional | | This will strip whitespace (or other characters) from the end of a string |
sanitize | Optional | | This will strip HTML and PHP tags from a string |
stringreplace | Optional | | Replace's parameter 'find' with parameter 'replace' in the provided text, can also accept regex 'modifier' param |
strip_tags | Optional | | This will strip HTML and PHP tags from a string |
stripcslashes | Optional | | This will un-quote a string quoted with addcslashes - it will take off 1 slash from a series of slashes (if there are 2 slashes, then 1 will remain) |
stripslashes | Optional | | This will un-quote a quoted string - it will take off 2 slashes from a series of slashes (if there are 3 slashes, then 1 will remain) |
strlen | Optional | | This will get the length of a string, including whitespace at the beginning and end of the string |
strrev | Optional | | This will reverse a string |
strtolower | Optional | | This will make a string lowercase |
strtoupper | Optional | | This will make a string uppercase |
tabs2space | Optional | | Replaces all tab characters with spaces |
tidyxml | Optional | | This will clean up XML content, replacing invalid characters when needed |
trim | Optional | | Will remove all whitespace when set to anything but empty. This defaults to being off. |
ucfirst | Optional | | This will make the first character of a string uppercase. NB: If the first character of the string is an empty space, there wil be no visible capitalization. |
ucwords | Optional | | This will make the first character of each word in a string uppercase |
Optional notes about the supported attributes.
This component defines no template variables.
This component does not output variables, just plain html or text.
'escape' converts HTML to escaped characters: i.e. converting <a> to <a>
The following code will convert <p> to <p> (view 'source code')
'strlen' displays the length of a string
The following code will display: 16
'stripslashes' will un-quote a string quoted with addcslashes
The following code will display: this is a string with its slash deleted