753 Posts in 310 Topics by 289 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 529 Views |
-
Can you have more than one widget in a page?

27 September 2012 at 9:09pm
Hoi,
I'm a SilverStripe newbie and I'm trying to get a youtube widget and a twitterfeed widget on one and the same page. But when I activate only the youtube widget it works but when i activate the twitterfeed widget as well the both stop working and the other way around. What can I do to get them both work? Is it even possible to get more then one widget on the same page?
Twitter widget:
TwitterWidgetPack-0.11.tar.gzYoutube widget:
widgets_featuredvideo-0.1.tar.gzPHP file:
class Mink extends Page {
public static $db = array(
);public static $has_one = array(
"YouTube" => "WidgetArea",
"Twitter" => "WidgetArea",
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.YouTube", new WidgetAreaEditor("YouTube"));
$fields->addFieldToTab("Root.Twitter", new WidgetAreaEditor("Twitter"));
return $fields;
}}
Pieces of the SS file:
<div class="box-small">
<div class="box-content">
<div class="title-small-red">
<div class="text">
<h2>@minkemacollege</h2>
101 volgers
</div>
</div>
<div class="twitter">
<div class="image"></div>
<div class="feed">
$Twitter
</div>
</div>
</div>
</div><div class="box-large">
<div class="box-content">
<h1>Beleef het Minkema College</h1>
<object width="350" height="197">
<div class="box-video">
$YouTube
</object>
</div>I have also the widget module.
Thank you,
Suzanne
-
Re: Can you have more than one widget in a page?

30 September 2012 at 6:26pm
Could you describe the error you get on the page? Or is the error in the backend? Usually you have 1 WidgetArea on a page and add in multiple individual widgets in that 1 area. Not sure if multiple WidgetAreas has been tested.
-
Re: Can you have more than one widget in a page?

2 October 2012 at 7:49pm
Hoi Willr,
It's not rely an error, i've attached a print screen so you can see.
The youtube widget say's that I should update my flash.
And the twitter widget just say's Widget title.Suzanne
-
Re: Can you have more than one widget in a page?

6 October 2012 at 6:21am Last edited: 6 October 2012 6:27am
i have pages with 3 widgetareas on ss 2.4 without any problems... made mywidgetarea 1 2 and 3 on on top and one on left and right side. As long theres no javascripterror between the widgets it no problem to show and use.
It could be that both widgets above have a javascriptproblem. Look in the source of the published page if 2 identical of kind of the same javascripts are loaded. So jquery.5.js and jquery.7.js for instance.
-
Re: Can you have more than one widget in a page?

10 May 2013 at 1:03am Last edited: 10 May 2013 1:05am
I currently have 4 widget areas on a homepage without any real problems. I just added some coding to manage them properly from the backend, which I did by adding sub-tabs to the Widgets tab (see picture). Otherwise all the widget areas get heaped up on one Widgets tab, and it's almost impossible to see which widget goes where...
This is the code for SS 3.05:<?php
class HomePage extends Page {static $has_one = array(
"HomeWidgetArea1" => "WidgetArea",
"HomeWidgetArea2" => "WidgetArea",
"HomeWidgetArea3" => "WidgetArea",
"HomeWidgetArea4" => "WidgetArea"
);public function updateCMSFields(FieldList $fields) {
$fields->addFieldToTab('Root.Widgets', new TabSet('Tab1'),'Area1');
$fields->addFieldToTab('Root.Widgets', new TabSet('Tab2'),'Area2');
$fields->addFieldToTab('Root.Widgets', new TabSet('Tab3'),'Area3');
$fields->addFieldToTab('Root.Widgets', new TabSet('Tab4'),'Area4');
}
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Widgets.Area1", new WidgetAreaEditor("HomeWidgetArea1"));
$fields->addFieldToTab("Root.Widgets.Area2", new WidgetAreaEditor("HomeWidgetArea2"));
$fields->addFieldToTab("Root.Widgets.Area3", new WidgetAreaEditor("HomeWidgetArea3"));
$fields->addFieldToTab("Root.Widgets.Area4", new WidgetAreaEditor("HomeWidgetArea4"));
return $fields;
}}
class HomePage_Controller extends Page_Controller {
}
| 529 Views | ||
|
Page:
1
|
Go to Top |


