Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

literal dollar sign in template


Reply


2 Posts   2543 Views

Avatar
jester12345

Community Member, 8 Posts

19 May 2009 at 7:41am

What is the right way to include a literal dollar sign in a template?

I've got some JavaScript, and "$f" is getting parsed out to nothing... kind of annoying.

I tried escaping the dollar sign to no avail. Ultimately I wrote a "DollarSign" function in the Page model that simply returns a literal dollar sign. So in the template "{$DollarSign}f" gets me what I need. It just seems so inelegant.

Avatar
Ben Gribaudo

Community Member, 181 Posts

23 May 2009 at 1:36am

Hum...I'm not recalling any way to escape the dollar sign using the current template parsing engine.

The [url=http://open.silverstripe.org/ticket/3738]template parsing patch[/url] I submitted implements escaping, such that template code "$$Something" will be output as a literal "$Something".

Ben