With Smarty as your template engine you usually have to put your script code inside a {literal}
tag, so to execute actualy php code inside your literal tag you have to put the php code outside of the literal, so you can either escape all your { }
within the script or break the literal for your echo, not pretty but should work: videoId: '{/literal}{$var}{literal}'
solved Displaying a PHP variable inside JS