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.

Archive /

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

Moderators: martimiz, Sean, biapar, Willr, Ingo

check variables


Go to End
Reply


3 Posts   911 Views

Avatar
WebSpilka

Community Member, 85 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, 85 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