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.


Discuss SilverStripe Widgets.

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

How to add widget on frontpage

Go to End

18 Posts   9152 Views


7 December 2009 at 11:03am Community Member, 332 Posts

added the widget area in page.php like so:


class Page extends SiteTree {
   public static $db = array(
   public static $has_one = array(
   "Sidebar" => "WidgetArea"
   function getCMSFields() {
   $fields = parent::getCMSFields();
   $fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("Sidebar"));
   return $fields;


How to show the html widget in the frontpage if its draged to widgets in cms


9 December 2009 at 2:27am (Last edited: 9 December 2009 2:28am), Community Member, 44 Posts

You should add $Sidebar in your template file (.ss)

You will find that you will have to add and configure the widgets for each page.
I wrote a module that make it easy to manage widgets - and allow adding widgets in one place.



9 December 2009 at 4:38am Community Member, 332 Posts

If i use the blackandy where i add $SidebarWidgets


9 December 2009 at 5:20am (Last edited: 9 December 2009 5:27am), Community Member, 44 Posts

it most suitable place is in templates/Includes/
But because blackandy display the sidebar only when there is a second lever menu, you need to make some changes there, to move the <% if Menu(2) %> check from the templates/Layout/ to the

attached the modified files.

Note: for some reason the attached file called instead of


9 December 2009 at 11:49am Community Member, 332 Posts

OK but if its installed and i wanna make lets say like widged where i can write what clients think about us how i sue it with widget manager


9 December 2009 at 12:16pm Community Member, 44 Posts

If that widget should be available to all pages (or anything more that one page), go to the "Widgets Manager" tab, create new widget (or select the default one).
The WidgetArea will come up (same as in the Forum), with extra "name" field. Set the name, Drag the widgets and save.
Then on each page you want to display that widgets, select the "content/widgets" tab and from the "Widgets Manager" pull-down choose the one you created. (and Make sure "Widgets currently used" is empty).
Second level pages will inherit it's parent widgets by default.

If you want the widget to be available only to one page, just use the "content/widgets" tab, drag the widget and save. again, second level pages will inherit that widgets by default.


9 December 2009 at 3:41pm Community Member, 332 Posts

yes but some widget needs the files. ss and .php where i install them i wanna add a widget where the owner can write text via cms in tinymce something like html widget but thisone dont show up in frontpage.

using ss 2.3.3 and htmlwidget and widget manager


10 December 2009 at 5:38am Community Member, 44 Posts

I dont use the htmlwidget, so I dont know to help you.
BTW: I made update to the WidgetsManager plugin.

Go to Top