API:setPlaceholder
From MODx Wiki
API Function Definition:
setPlaceholder
- Versions
- > 0.9.2
- Return Values
- Success: null
- Fail: null
- Data Type
- void
- Object Hierarchy
- DocumentParser
void setPlaceholder(string $name, string $value);
setPlaceholder saves $value to an array with an index of $name. Placeholders are merged with the content when parseDocumentSource is called which, in turn executes mergePlaceholderContent. From there, the parse will take the array created by setPlaceholder and run through the content, replacing all instances of [+$name+] with $value.
[edit]
Examples
$modx->setPlaceholder('jobtitle','Systems Engineer'); return 'I am a [+jobtitle+]!';
[edit]
Related functions
[edit]
Function source
| File: | manager/includes/document.parser.class.inc.php |
|---|---|
| Line: | 1935 |
function setPlaceholder($name, $value) { $this->placeholders[$name] = $value; }
[edit]
Notes
This function is very simple, simply setting a value to an associative array. However, placeholders are a powerful tool when used correctly.
