I just faced a problem: smarty sintaxis in templates is between {} and also one of the jquery mobile components uses {} for its onw purposes and so i get an error from smarty. Is there a solution to this problem?
<input name="mydate" id="mydate" type="date" data-role="datebox" data-options='{"mode": "calbox"}'>
Use the {literal}
tag:
<input ... data-options='{literal}{"mode": "calbox"}{/literal}'>
If you are using smarty 3, simply leave spaces between the {}:
<input name="mydate" id="mydate" type="date" data-role="datebox" data-options='{ "mode": "calbox" }'>
See http://www.smarty.net/v3_overview under "(Javascript) Auto-Escapement"
You could also use {rdelim}
and {ldelim}
as an alternative. I find it especially usefull if you want to mix js and smarty. They will be replaced with the curly brace by smarty, and you can still use smarty code between them, wich is not the case when using the {literal}
. Your sample would look something like this:
<input name="mydate" id="mydate" type="date" data-role="datebox" data-options='{ldelim}"mode": "calbox"{rdelim}'>