This question has been answered by Ysanmiguel. See the first response.
$delimiter = $modx->getOption('delimiter',$scriptProperties,','); $values = explode($delimiter,$modx->getOption('values',$scriptProperties,'')); $emptyChunk = $modx->getOption('emptyChunk',$scriptProperties,''); $fullChunk = $modx->getOption('fullChunk',$scriptProperties,''); $tpl = $fullChunk; if (is_array($values)){ foreach ($values as $value){ if (empty($value)){ $tpl = $emptyChunk; break; } } } return $modx->getChunk($tpl,$scriptProperties);
[[isOneEmpty? &values=`[[+placeholder1]],[[+placeholder2]]` &emptyChunk=`emptyChunk` &fullChunk=`fullChunk`]]
$delimiter = $modx->getOption('delimiter',$scriptProperties,'~');
[[isOneEmpty? &values=`[[+placeholder1]]~[[+placeholder2]]` &emptyChunk=`emptyChunk` &fullChunk=`fullChunk`]]
[[getImageList? &tvname=`migxTv` &tpl=`tpl.here` &toPlaceholder=`placeholder1` ]]
Try adding &delimiter=`~` to the snippet tag.
Using ~ as a delimiter might be confusing the parser, since it's a MODX token for link tags. Try &delimiter=`xxx` and put xxx between the placeholders (with no spaces before of after xxx).
$delimiter = $modx->getOption('delimiter',$scriptProperties,'xxx');
[[isOneEmpty? &values=`[[+placeholder1]]xxx[[+placeholder2]]` &emptyChunk=`emptyChunk` &fullChunk=`fullChunk` &delimiter=`xxx`]]
[[getImageList? &tvname=`migxTv` &tpl=`tpl.here` &toPlaceholder=`placeholder1` ]] [[+placeholder1]]
[[getImageList? &tvname=`migxTv` ]]
$delimiter = $modx->getOption('delimiter',$scriptProperties,','); $values = explode($delimiter,$modx->getOption('values',$scriptProperties,'')); $emptyChunk = $modx->getOption('emptyChunk',$scriptProperties,''); $fullChunk = $modx->getOption('fullChunk',$scriptProperties,''); $tpl = $fullChunk; if (is_array($values)){ foreach ($values as $value){ $modx->log(modX::LOG_LEVEL_ERROR, 'XXX' . $value . 'XXX'); // Added if (empty($value)){ $tpl = $emptyChunk; break; } } } return $modx->getChunk($tpl,$scriptProperties);
Yes, the nesting could be an issue if the isOneEmpty snippet is getting the placeholder tags themselves rather than the processed tags' values.
Try this, then look at the error log:
$delimiter = $modx->getOption('delimiter',$scriptProperties,','); $values = explode($delimiter,$modx->getOption('values',$scriptProperties,'')); $emptyChunk = $modx->getOption('emptyChunk',$scriptProperties,''); $fullChunk = $modx->getOption('fullChunk',$scriptProperties,''); $tpl = $fullChunk; if (is_array($values)){ foreach ($values as $value){ $modx->log(modX::LOG_LEVEL_ERROR, 'XXX' . $value . 'XXX'); // Added if (empty($value)){ $tpl = $emptyChunk; break; } } } return $modx->getChunk($tpl,$scriptProperties);
[2017-10-02 12:11:58] (ERROR @ /home/user/modx/core/cache/includes/elements/modsnippet/115.include.cache.php : 10) XXX <div class="small-12"> <div class="row"> <HTML code....> </div> </div> XXX [2017-10-02 12:11:58] (ERROR @ /home/montours/modx/core/cache/includes/elements/modsnippet/115.include.cache.php : 10) XXX[[+placeholder2]]XXX
[[!+placeholder]]
Yes, definitely.
You might try calling the placeholder uncached.
[[!+placeholder]]
That should delay the processing of the placeholder, hopefully until after the time it's set.
[[isOneEmpty? &values=`[[!+placeholder1]]xxx[[!+placeholder2]]` &emptyChunk=`emptyChunk` &fullChunk=`fullChunk` &delimiter=`xxx`]]
[2017-10-03 08:05:21] (ERROR @ /home/user/modx/core/cache/includes/elements/modsnippet/115.include.cache.php : 10) XXX[[!+placeholder1]]XXX [2017-10-03 08:05:21] (ERROR @ /home/user/modx/core/cache/includes/elements/modsnippet/115.include.cache.php : 10) XXX[[!+placeholder2]]XXX
[[!isOneEmpty? &values=`[[+placeholder1]]xxx[[+placeholder2]]` &emptyChunk=`emptyChunk` &fullChunk=`fullChunk` &delimiter=`xxx`]]