lets say I have a smarty variable TAKEN FROM DATABASE called
$myvar = "i am very happy {-: "
if I try to display it, it gave me "500 Internal Errors" because the string contains "{" character which is used by smarty. since its from the database, I dont have any control on the values it will give me... what I noticed if the string contains those characters it gives me error.
how can i display the spacial charater correctly without causing this errors? Hope somebody can help!
literal is not a good way to use it
{ldelim} for {
{rdelim} for }
is a good choice if you want to use them.
For example if you want to send a json like below
send('[{'ID':1},{'Answer':'A'}]');
the code will be like this in tpl file:
send('[{ldelim}'ID':{$smarty.session.user_id}{rdelim},{ldelim}'Answer':'A'{rdelim}]');
Try outputting your data between{literal} {/literal} tags. See {literal} Smarty documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With