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

Avatar
rob.s

Community Member, 78 Posts

13 January 2011 at 11:27pm

Edited: 13/01/2011 11:27pm

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

Community Member, 78 Posts

19 January 2011 at 9:56pm

Solution:

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