API:parseChunk
From MODx Wiki
API Function Definition:
parseChunk
- Versions
- all
- Return Values
- Success: parsed chunk
- Fail: boolean false
- Data Type
- string
- Object Hierarchy
- DocumentParser
string parseChunk(string $chunkName, array $chunkArr[, string $prefix[, string $suffix]]);
Run through the given chunk ($chunkName), replacing all the indices (plus the $prefix and $suffix) of $chunkArr with their respective values.
- $prefix & $suffix default to "{" & "}" respectively (minus quotes)
- If $chunkArr is not an array, this functions returns boolean false.
[edit]
Examples
$output= "<ul id=\"recordlist\">"; for($i=0; $i<count($records);$i++){ $cover=$records[$i][0]['value']; $id=$records[$i][1]['value']; $pagetitle=$records[$i][2]['value']; $cover=$modx->config['site_url']."assets/images/cover/nocover.gif" ; } 'recordlink' => $modx->makeUrl($id), 'recordname' => $pagetitle, 'coverimage' => $cover ); $output .= $modx->parseChunk('recordList', $chunkArr, '[+', '+]'); } $output .= "</ul>";
[edit]
Function Source
| File: | manager/includes/document.parser.class.inc.php |
|---|---|
| Line: | 1722 |
[edit]
