in modx you can for example do this:
create a chunk:
[+name+] x [+quantitiy+] @ [+costperitem+] total cost: [+totalcost+]
and loop thrue your array with snippet
example:
<?php
foreach ($items as $item){
$item['totalcost']=$item['quantitiy']*$item['costperitem'];
$output.=$modx->parseChunk($tpl,$item,'[+','+]');
}
return $output;
then you can call it like that:
Here are your products [!getcustomer_name!]:
[!listproducts? &tpl=`listproductsChunk` !]
Thanks Bruno, that’s super-helpful. So essentially parseChunk() is a way of programmatically manipulating placeholders (or anything else) in a chunk at a lower level than you can with setPlaceholder() or similar.
Thanks again,
Alex
parsechunk gets the chunk and replaces the placeholders in it with your values given in your array.
you can also have a look to jot or maxigallery how these snippets work for example.
They use the chunkie-class to replace placeholders and parse them with phx in its chunks.
FYI, in Revolution, I believe you could actually use Smarty for this, since it’s installed for use in the Mgr.