I wrote the following snippet:
<?php
$width = (isset($width)) ? strtolower($width) : '360';
$height = (isset($height)) ? strtolower($width) : '320';
$widgetid = (isset($widgetid_or_url)) ? $widgetid_or_url : '0bvyu5ufqw';
$objectid = (isset($objectid)) ? $objectid : 'kdp' . md5(uniqid(rand(), true));
$flashvars = (isset($flashvars)) ? $flashvars : '';
// use parseChunk to parse the objecttag_chunk placeholders and return the chunk
$chunkArr = array(
'width' => $width,
'height' => $height,
'widgetid' => $widgetid,
'objectid' => $objectid,
'flashvars' => $flashvars
);
return $modx->parseChunk('objecttag_chunk', $chunkArr, '[[+', ']]');
?>
when I run the code i get "Parse error: parse error in C:\xampp\htdocs\modx_rev\revolution\core\cache\web\elements\modSnippet\1.cache.php on line 36";
When I change the code to use "setPlaceholder" method instead it works OK...
see the following (that is run fine):
//manually set parameters to objecttag_chunk placeholders and return the chunk
$modx->setPlaceholder('width', $width);
$modx->setPlaceholder('height', $height);
$modx->setPlaceholder('widgetid', $widgetid);
$modx->setPlaceholder('objectid', $objectid);
$modx->setPlaceholder('flashvars', $flashvars);
return $modx->getChunk('objecttag_chunk');
my objecttag_chunk is fairly simple:
<object width="[[+width]]" height="[[+height]]" type="application/x-shockwave-flash" data="http://www.kaltura.com/index.php/kwidget/wid/[[+widgetid]]" id="[[+objectid]]"><param name="wmode" value="opaque"/><param name="flashvars" value="[[+flashvars]]"/><param name="allowScriptAccess" value="always"/><param name="allowfullscreen" value="true"/></object>
Any ideas what’s wrong with my "getChunk" ?