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   1671 Views

Avatar
snaip

Community Member, 180 Posts

27 May 2010 at 4:05am

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

Community Member, 80 Posts

27 May 2010 at 5:52am

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

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

Avatar
snaip

Community Member, 180 Posts

27 May 2010 at 6:34am

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

Avatar
lerni

Community Member, 80 Posts

27 May 2010 at 8:13am

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

Avatar
Willr

Forum Moderator, 5513 Posts

27 May 2010 at 1:17pm

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.