I am sure this is a caching issue, but not sure how to fix it.
This is going to be a pain to describe...hopefully someone can follow along.
In a template I am calling a tv which then includes an external chunk but I'll skip that and go straight to the chunk content...
[[!getFormQuestion? &id=`1` &qType=`radio`]]
[[!getFormQuestion? &id=`2` &qType=`radio`]]
So this is an uncached snippet call that I'd like to run back to back with different properties.
Snippet Details:
<?php
//Setting the snippet properties in an array so I can pass it to the html code chunk
$properties = array(
'id' => $id,
);
switch ($qType)
{
case 'radio':
$code = $modx->getChunk('formRadioQuestion',$properties);
//added the print_r so I could see the array property values during debug
$output = print_r($properties) . $code;
return $output;
break;
}
?>
I'm simplifying formRadioQuestions code chunk to display the problem..
<div id="Question[[+id]]">
<p>QuestionID is set to: [[+id]]</p>
</div>
So the first snippet call works as expected and sets the placeholder id as 1 which produces this output:
Array ( [id] => 1 ) 1
QuestionID is set to 1
and the source code:
<div id="Question1">
<p>QuestionID is set to 1</p>
</div>
Now the next snippet call is where I am getting cached values.
Snippet call:
[[!getFormQuestion? &id=`2` &qType=`radio`]]
produces this output:
Array ( [id] => 2 ) 1
QuestionID is set to 1
and the source code:
<div id="Question1">
<p>QuestionID is set to: 1</p>
</div>
so this call is in fact passing the right property value (id=2)
$code = $modx->getChunk('formRadioQuestion',$properties);
but...
Once the actual code chunk is processed, it is using a cached value for the placeholder
SO I tried adding
to prevent any caching there but then the placeholder doesn't contain any value at all.
Ideas?