753 Posts in 312 Topics by 289 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 460 Views |
-
Multiple Themes For Widgets

29 June 2011 at 11:22pm Last edited: 29 June 2011 11:25pm
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.
[bold]Edit[/bold]
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));
var_dump($widget);die();
return $widget->renderWith('WidgetHolder');
} -
Re: Multiple Themes For Widgets

30 June 2011 at 1:29am
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');
Win!
| 460 Views | ||
|
Page:
1
|
Go to Top |

