We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33587
    • 16 Posts
    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" ?
      • 22303 MODX Staff
      • 10,725 Posts
      No idea, what’s on line 36 of the cached snippet file?
        • 26903
        • 1,336 Posts
        Just typed it into one of my test revo’s, works for me, cached or uncached, see piccy. Im up to date here i.e. svn 4744.
          Use MODx, or the cat gets it!
          • 33587
          • 16 Posts
          well, ashamed to say, i just had a typo lipsrsealed
          (return = ... instead of return ...)

          anyway, for those wondering, this is the very beginning of the Kaltura-MODx extension wink