Hi all
I have a problem when i create snippets that loop through TVs, set placeholders and then output a chunk based on those placeholders. The code looks like this:
<?php
for ($i=1; $i <= 3; $i++) {
$startValue = $modx->getTemplateVarOutput('travel_'.$i.'_startDate');
$startValue = $startValue['travel_'.$i.'_startDate'];
$endValue = $modx->getTemplateVarOutput('travel_'.$i.'_endDate');
$endValue = $endValue['travel_'.$i.'_endDate'];
$guide = $modx->getTemplateVarOutput('travel_'.$i.'_guide');
$guide = $guide['travel_'.$i.'_guide'];
if (strlen($startValue) != 0 && strlen($endValue) != 0) {
$modx->setPlaceholder('startDate', $startValue);
$modx->setPlaceholder('endDate', $endValue);
$modx->setPlaceholder('guide', $guide);
echo $modx->getChunk('travelDatesRow');
}
}
?>
This will output:
12-01-2009 - 31-01-2009 with: Guide Name
12-01-2009 - 31-01-2009 with: Guide Name
because my chunk (travelDatesRow) look like this:
[+startDate+] - [+endDate+] with: [+guide+]
My problem is that only the values of the
LAST TV entries are outputtet. It is not being outputtet as the loop goes through the different TVs (see how the values are the same. It is not set that way in the document).
I am calling the snippet uncached...
Any help is greatly appreciated.
Jonas