How to pass through {{ double bracket in mustache

712 views Asked by At

Quick question. I have a template that is rendered in mustache in php. But it includes sections that are to be rendered in ICH in the client browser.

I cannot work out how to tell mustache in php not to render {{var}} that I want to pass to ICH.

IE I want to see {{variable}} in the html source so that ICH can pick it up.

How do I escape {{ to get it past the php mustache?

Sample:

<script id="user" type="text/html">
    \{\{name\}\} {{twitter}} {{{twitter}}} 
</script>

but in my html it becomes

<script id="user" type="text/html">
  \{\{name\}\} 
</script>
1

There are 1 answers

2
Manuel B. On BEST ANSWER

You can escape the double braces with a backslash like this

\{{ name }}

Another way is to change the delimeter temporarly like this

{{=<% %>=}}
 {{name}}
<%={{ }}=%>

Sorry, I can't comment your post because of my reputation.