17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 665 Views |
-
check variables

15 October 2008 at 9:47pm
hi
How can I check in the template *.ss one of the variables if it is empty?
I try<% if Linkwww %>
<div class="Linkwww"><a href="http://{$Linkwww}">$Linkwww</a></div>
<% end_if %>but nothing goes
-
Re: check variables

15 October 2008 at 11:33pm Last edited: 15 October 2008 11:38pm
How are you defining your variable?
Test it out with:
<% if Content %>
This page has content!
<% end_if %>That should work.
--
If blocks (http://doc.silverstripe.com/doku.php?id=templates)
<% if Property %>
<% end_if %>If blocks let you mark off optional content in your template. The optional content will only be shown if the requested field / method returns a nonzero value.
-
Re: check variables

15 October 2008 at 11:41pm
thanks
But as it turned out the problem in anotherl have next code on my ProdHolder.ss
<% control Children %>
<div class="ProdBl">
<div class="prev"><a href="$Link" title="$Title.XML">$Photo.SetWidth(150)</a></div>
<div class="Prodtext">
<h4><a href="$Link" title="$Title.XML">$Title</a></h4>
$Content
$Linkwww
<% if Linkwww %>
<div class="Linkwww"><a href="http://{$Linkwww}">$Linkwww</a></div>
<% end_if %>
</div>
<div class="clear1"><!-- --></div>
</div>
<% end_control %>
my ProdHolder.ss does not see $Linkwww from Children Pages
| 665 Views | ||
|
Page:
1
|
Go to Top |


