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

how to print $ . in a template ?


Reply

5 Posts   1643 Views

Avatar
snaip

27 May 2010 at 4:05am Community Member, 180 Posts

hi

it is a big problem

i want to put in a template somethnig like this $URL

but '$ with words' executing the function or variable from databese

so how to print $URL like a simple text without using HTML Encoding Tags like %24 %24 = $ ?

another problem, how to print a dot ?

this problem appears in <a> tag
<a href="$Parent.URLSegment/$URLSegment.html">

.html doesnt work becouse "." ".html" is treating like another function (?) to $URLSegment
so how to stop (?) rendering SS function and start print HTML character ?

maby is there any escape character like ; \ / ? $URLSegment;.html $URLSegment\.html doesnt work too

at know i am using this $URLSegment%2Ehtml but in source i still have %2Ehtml and it is not very good in view Google Analytics

using SS 2.4

Avatar
lerni

27 May 2010 at 5:52am Community Member, 80 Posts

<a href="$Parent.URLSegment/$URLSegment.html">

<a href="{$Parent.URLSegment}/{$URLSegment}.html">

Avatar
snaip

27 May 2010 at 6:34am Community Member, 180 Posts

great !
where did you found it ?
could you give me a link to documentation ?

Avatar
lerni

27 May 2010 at 8:13am Community Member, 80 Posts

i've picked it up somewhere..?? but it's also in the comments here (bottom):
http://doc.silverstripe.org/templates

Avatar
Willr

27 May 2010 at 1:17pm Forum Moderator, 5511 Posts

I've added some notes and an example to http://doc.silverstripe.org/templates#escaping. Not sure if its 100% clear with the naming as escaping relates more specifically to escaping for attributes, xml, sql etc but couldn't think what else would make sense.