Jump to:

796 Posts in 409 Topics by 304 members


SilverStripe Forums » Widgets » Multiple Themes For Widgets

Discuss SilverStripe Widgets.

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

Page: 1
Go to End
Author Topic: 606 Views
  • mrsteveheyes
    Community Member
    15 Posts

    Multiple Themes For Widgets Link to this post

    Hi there,

    I'm new to Silverstripe but am loving it so far. I have created a widget for pulling in Social Media which is working great. But I am working on a site which has a twitter feed and a facebook feed. Both have different HTML and CSS.

    So I was wondering if I can dictate which theme the Widget should use rather than just using the default one?

    Hope that makes sense.


    For more context here is the function I'm using the Page Controller to render the Twitter feed:

    public function TwitterStream() {
       $widget = new SocialPulseWidget();
       $widget->WidgetTitle = 'Our Tweets';
       $widget->addFeed('twitter', array('name' => 'prbloke', 'links' => true));
       return $widget->renderWith('WidgetHolder');

  • mrsteveheyes
    Community Member
    15 Posts

    Re: Multiple Themes For Widgets Link to this post

    Actually! I figured out how to do it!

    You can create a tempalte file in /themes/{theme_name}/templates/layout and call it in renderWith.

    So for example: I have create a TwitterStream.ss file in the right folder and now I just use:

    return $widget->renderWith('TwitterStream');


Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.