Function __global->template_to_tempcode
Definitions
sources/tempcode_compiler.php
- Convert template text into Tempcode format.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $text | string | No | No | required parameter | N/A | N/A | The template text |
| $symbol_pos | integer | No | No | 0 | N/A | N/A | The position we are looking at in the text |
| $inside_directive | boolean | No | No | False | N/A | N/A | Whether this text is in fact a directive, about to be put in the context of a wider template |
| $codename | ID_TEXT | No | No | Blank (empty string) | N/A | N/A | The codename of the template (blank: not from a file) |
| $theme | ?ID_TEXT | No | No | Null | N/A | N/A | The theme it is for (null: current theme) |
| $lang | ?ID_TEXT | No | No | Null | N/A | N/A | The language it is for (null: current language) |
| $tolerate_errors | boolean | No | No | False | N/A | N/A | Whether to tolerate errors |
| &$parameters | ?array | Yes | No | Null | N/A | N/A | Parameters to hard-code in during compilation (null: no hard-coding) |
| $suffix | ?string | No | No | Null | .tpl .js .xml .txt .css | N/A | File type suffix of template file (e.g. .tpl) (null: not from a file) |
| $directory | ?string | No | No | Null | N/A | N/A | Subdirectory type to look in. Surrounded by '/', unlike with $directory parameters to most other functions (performance reasons) (null: not from a file) |
Returns
- The converted/compiled template as Tempcode, OR if a directive, encoded directive information
- Type: mixed
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Convert template text into Tempcode format.
*
* @param string $text The template text
* @param integer $symbol_pos The position we are looking at in the text
* @param boolean $inside_directive Whether this text is in fact a directive, about to be put in the context of a wider template
* @param ID_TEXT $codename The codename of the template (blank: not from a file)
* @param ?ID_TEXT $theme The theme it is for (null: current theme)
* @param ?ID_TEXT $lang The language it is for (null: current language)
* @param boolean $tolerate_errors Whether to tolerate errors
* @param ?array $parameters Parameters to hard-code in during compilation (null: no hard-coding)
* @param ?string $suffix File type suffix of template file (e.g. .tpl) (null: not from a file)
* @set .tpl .js .xml .txt .css
* @param ?string $directory Subdirectory type to look in. Surrounded by '/', unlike with $directory parameters to most other functions (performance reasons) (null: not from a file)
* @return mixed The converted/compiled template as Tempcode, OR if a directive, encoded directive information
*/
function template_to_tempcode(string $text, int $symbol_pos = 0, bool $inside_directive = false, string $codename = '', ?string $theme = null, ?string $lang = null, bool $tolerate_errors = false, ?array &$parameters = null, ?string $suffix = null, ?string $directory = null)
* Convert template text into Tempcode format.
*
* @param string $text The template text
* @param integer $symbol_pos The position we are looking at in the text
* @param boolean $inside_directive Whether this text is in fact a directive, about to be put in the context of a wider template
* @param ID_TEXT $codename The codename of the template (blank: not from a file)
* @param ?ID_TEXT $theme The theme it is for (null: current theme)
* @param ?ID_TEXT $lang The language it is for (null: current language)
* @param boolean $tolerate_errors Whether to tolerate errors
* @param ?array $parameters Parameters to hard-code in during compilation (null: no hard-coding)
* @param ?string $suffix File type suffix of template file (e.g. .tpl) (null: not from a file)
* @set .tpl .js .xml .txt .css
* @param ?string $directory Subdirectory type to look in. Surrounded by '/', unlike with $directory parameters to most other functions (performance reasons) (null: not from a file)
* @return mixed The converted/compiled template as Tempcode, OR if a directive, encoded directive information
*/
function template_to_tempcode(string $text, int $symbol_pos = 0, bool $inside_directive = false, string $codename = '', ?string $theme = null, ?string $lang = null, bool $tolerate_errors = false, ?array &$parameters = null, ?string $suffix = null, ?string $directory = null)
