javascriptcontent-management-systemplaceholdermodxmodx-evolution

ModX Evolution: Template Variable Conflict


I'm writing a javascript plugin using instafeed.js. I'm having a problem with ModX Evolution because of this line of my code:
template: '<a href="{{link}}"><img src="{{image}}" /></a>'

I'm pretty sure ModX is trying to associate {{link}} and {{image}} with Chunks that do not exist, causing my plugin to crash. Is there a way to tell ModX that {{link}} and {{image}} are not Chunks, but part of the javascript?


Solution

  • That is exactly what modx is trying to do - take a peek at the source or in a browser inspector, if modx is trying to parse them your code will look like:

     template: '<a href=""><img src="" /></a>'
    

    I don't know of any way to tell modx not to parse them, BUT if you include your script rather than inline modx will not parse it. i.e.

    <script src="path-to-script" ></script>