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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

Our old forums are still available as a read-only archive.

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

check variables


Go to End


3 Posts   1112 Views

Avatar
WebSpilka

Community Member, 89 Posts

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

Avatar
Piklets

Community Member, 36 Posts

15 October 2008 at 11:33pm

Edited: 15/10/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.

Avatar
WebSpilka

Community Member, 89 Posts

15 October 2008 at 11:41pm

thanks
But as it turned out the problem in another

l 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