Escaping - How?

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
psiege
Regular
Posts: 52
Joined: Thu Mar 27, 2008 4:21 pm

Escaping - How?

Post 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!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Escaping - How?

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
psiege
Regular
Posts: 52
Joined: Thu Mar 27, 2008 4:21 pm

Post by psiege »

It was most simple! Simply adding

Code: Select all

|escape
did the trick. Thanks!
Post Reply