Ok - i’m struggling here...
I’ve created a snippet that uses the api to generate a ditto call, which works great. Now I want the chunk that ditto uses for the ’tpl’ parameter to be parsed for a custom placeholder before it is passed on to ditto.
Why don’t i just use a TV for each document to supply the value? Because the value can be one of several values for each document, depending on context of where it is viewed in the site. Its a category list, basically, and a product can appear in several categories, but in each instance I want to show something in the ditto output that only shows the current category.
// replace the custom parameter in the original chunk before passing to ditto.
$p['currentCategory'];
$new_chunk = $modx->parseChunk('original_chunk', $p, '{+', '+}');
// run the ditto part
$params = array(
'parents' => 3,
'display' => 'all',
'tpl' => $new_chunk,
'extenders' => 'tagging',
'tagData' => 'solutionCategories',
'tags' => $solution_cat,
'tagDelimiter' => ','
);
$out = $modx->runSnippet('Ditto', $params);
return $out;
When i echo the chunk once i’ve done my replacement, the other placeholders are gone, but if I die with the chunk in the same spot, the placeholders are still there...?
Either way, the result is my parsed chunk is not accepted by ditto - i get the ’
&tpl either does not contain any placeholders or is an invalid chunk name, code block, or filename. Please check it.’ message.
I’m stuck on understanding why my parsed chunk - using custom placeholder characters - is not returning a usable string. And why echo/die show different results.