Reputation: 842
I have some code that I am working on that has inline values such as {32,15}
for some JavaScript, for a client. However it always causes an fatal error, in these cases. Is there a way that I can escape the curly braces so that they do not set off any more fatal errors, and still not affect the JavaScript?
Upvotes: 3
Views: 2898
Reputation: 225115
Put it inside {literal}...{/literal}
, like so:
{literal}
<script>
(function() {
alert("Hooray for curly braces!");
})();
</script>
{/literal}
Upvotes: 11
Reputation: 17321
You can also use {ldelim}{rdelim}
tags in place of the curly braces themselves. This is useful if you need working Smarty tags within the escaped braces.
<script language="javascript">
<!--
function getPrompt() {ldelim}
// js function here
{rdelim}
//-->
</script>
Source: http://www.smarty.net/docs/en/language.function.ldelim.tpl
Upvotes: 1
Reputation: 18863
Use the {literal}
tag that smarty provides. That is the only method I know of.
Upvotes: 0