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.

Widgets

Discuss SilverStripe Widgets.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Widget in template / isEmpty [solved]


Reply

2 Posts   786 Views

Avatar
rob.s

13 January 2011 at 11:27pm (Last edited: 13 January 2011 11:27pm), Community Member, 78 Posts

Hi,

how do i recognize if widget area is empty ?
I need this inside the template

The name of my widgetArea is 'SideBlock'

The following template code does NOT work for me.
(guessing the method SideBlock() only returns false/null when the relation does not exist)

<% if SideBlock %>
<div class="span-18">
<% else %>
<div class="span-24 last">
<% end_if %>

Any ideas ?

Grettings,
Rob

Avatar
rob.s

19 January 2011 at 9:56pm Community Member, 78 Posts

Solution:

<% if SideBlock.Widgets %>
<div class="span-18">
<% else %>
<div class="span-24 last">
<% end_if %>