Page 1 of 1

Escaping - How?

Posted: Fri Apr 04, 2008 9:00 pm
by psiege
I'm using this code within a script:

Code: Select all

var DOCUMENTNAME='{$head_title|@default:$blogTitle}{if $head_subtitle} - {$head_subtitle}{/if}';
However, I need to escape any apostrophes that appear in my title and subtitles. Is this possible?

This particular code appears in entries.tpl.

Thanks!

Re: Escaping - How?

Posted: Fri Apr 04, 2008 9:32 pm
by garvinhicking
Hi!

I think the smarty "escape" modifier has an option so that it can be used within javascript escaping?!

Else you can use the 'replace' modifier.

(see smarty.php.net)

HTH,
Garvin

Posted: Fri Apr 04, 2008 10:22 pm
by psiege
It was most simple! Simply adding

Code: Select all

|escape
did the trick. Thanks!