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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

literal dollar sign in template


Go to End


2 Posts   4568 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 template parsing patch I submitted implements escaping, such that template code "$$Something" will be output as a literal "$Something".

Ben