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

General Widget Question


Go to End
Reply

13 Posts   6397 Views

Avatar
KeithLeslie

4 January 2009 at 4:37pm Community Member, 6 Posts

Are widgets only for use with the blogs? The documentation makes it sound like widgets can only be used with the blogs. Is this correct? Is there any widget construct for using something like a widget on the home page? I have to show 3 posts from an RSS feed. I have the PHP code ready, but not sure how to integrate. Any help would be greatly appreciated.

Avatar
Willr

4 January 2009 at 5:58pm Forum Moderator, 5511 Posts

Currently by default only the blog makes use of widgets but there is no reason why they can't be used on other pages. See this page for more information

http://doc.silverstripe.com/doku.php?id=widgets#adding_widgets_to_other_pages

Avatar
micahsheets

10 January 2009 at 8:42am Community Member, 165 Posts

I have made it so my widgets can show up on all my pages. However I can't figure out how to make a global interface to manage the content in my widget. I don't want to have to go to every page and manually set up the widget since it should show the same info on each page. However I also want to be able to manage this from a gui and not the _config file. One widget I have is an advertising area where the site owner can select an image and type some text in as a description or link to more info etc. The way it seems to work is every page I add the widget to I have to link to the image and type the text in.

I have read some things on the forum about having a global settings area but it seems that the developers may not like this idea as it may be over designing. I think having a way for developers to add system wide settings is very important as I have many things I would like to put in such an interface that would make managing the site better for non-developer/programmer types.

Please consider again adding a way to manage global widgets with the ability to show or not show the global widget on page types.

Also I really would like to see widgets stored in a widgets folder at the root instead of having separate folders for each one at the root of the site.

thanks

Avatar
Hamish

10 January 2009 at 7:52pm (Last edited: 10 January 2009 7:56pm), Community Member, 712 Posts

To make it appear on all pages you could create a special 'PageHolderPage' that all other pages are descendants of.

Ie, in your site tree, your site would look something like:

root
_+- PageHolder
___ +- Home
___ +- About
___ +- Stores
_____ +- Auckland
_____ +- Wellington
____ +- Contact

edit: GAH, why does the forum code block not respect whitespace? Impossible for format code nicely!!! Pretend that those underscores are spaces..

You apply the widget to the PageHolder page. Since all other pages are descendants of this one page, you can also access this 'global' widget (or whatever other data is held by PageHolder) with the appropriate tags.

This is a nice clean way to emulate a 'system wide' setting (or, really, just a root page setting) without adding new functionality.

Avatar
Hamish

10 January 2009 at 7:59pm (Last edited: 10 January 2009 7:59pm), Community Member, 712 Posts

Note that this is exactly what happens in the blog - the BlogHolder object holds the widget, while the actual pages you see are BlogEntry objects. We're just extending the concept to cover the whole site :)

Avatar
micahsheets

15 January 2009 at 10:56am Community Member, 165 Posts

Ok, I see how that would work. What tag would cause the parent page widget to show up in the child pages?

Avatar
tzeller

18 January 2009 at 7:38am Community Member, 26 Posts

i have found an error in the php-script which causes a width-problem

GoogleChartWidget.php Line 17 downwards:

"FrameWidth" => "Int"

is missing

Avatar
ulysses

24 November 2009 at 2:13pm Community Member, 57 Posts

Hi Hamish,

I like your concept of the PageHolder page.

Do you have an example on this implementation. Or better still can a copy of this page be posted on this forum.

I am trying to make the Widgets available on every page type in SilverStripe 2.3.3 but the Widgets tab is only available in the Blog page type in the CMs.

My Skype ID is: ulyssesnz

Your help would be much appreciated.

Mauricio

Go to Top