Prevent Escape in JSON String

164 views
Skip to first unread message

Arief

unread,
Oct 23, 2013, 11:40:01 PM10/23/13
to rai...@googlegroups.com
Hi,

How to prevent raintpl replacing quote with " (html entities) for json string decoded using php json_decode() ?

In html template (js) : 
var data = {$json_data}; ---> this should be [{"field":"value"}] not [{"field":"value"}]

Thanks.

Rain

unread,
Oct 24, 2013, 5:39:44 PM10/24/13
to rai...@googlegroups.com
Arief just disable auto_escape
Tpl::configure("auto_escape", false);

Arief

unread,
Oct 24, 2013, 7:59:03 PM10/24/13
to rai...@googlegroups.com
Hi Rain,

Thanks for your reply. In my case only json data that need to be unescaped, the rest in the html file should keep being autoescaped. How to get around this?

Regards,

Rain

unread,
Oct 29, 2013, 1:00:20 AM10/29/13
to rai...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages