hotPocket
hotPocket

Reputation: 69

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?

Upvotes: 0

Views: 158

Answers (2)

orbitory
orbitory

Reputation: 1120

You can also do this inline using a plugin and adding a space between the {{ and }} like { { and } } The plugin is called Brakify and it removes the space after modx evolution parsed the content.

I use this with angular when an external script doesn't work.

Upvotes: 1

Sean Kimball
Sean Kimball

Reputation: 4494

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>

Upvotes: 1

Related Questions