751 Posts in 310 Topics by 289 members
| Go to End | Next > | |
| Author | Topic: | 7538 Views |
-
How to add widget on frontpage

7 December 2009 at 11:03am
added the widget area in page.php like so:
<?php
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
-
Re: How to add widget on frontpage

9 December 2009 at 2:27am Last edited: 9 December 2009 2:28am
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.
http://ssorg.bigbird.silverstripe.com/all-other-modules/show/274910?showPost=275040Rotem.
-
Re: How to add widget on frontpage

9 December 2009 at 4:38am
If i use the blackandy where i add $SidebarWidgets
-
Re: How to add widget on frontpage

9 December 2009 at 5:20am Last edited: 9 December 2009 5:27am
it most suitable place is in templates/Includes/SideBar.ss
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/Page.ss to the SideBar.ss.attached the modified files.
Note: for some reason the attached file called Page4.ss instead of Page.ss
-
Re: How to add widget on frontpage

9 December 2009 at 11:49am
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
-
Re: How to add widget on frontpage

9 December 2009 at 12:16pm
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.
-
Re: How to add widget on frontpage

9 December 2009 at 3:41pm
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
-
Re: How to add widget on frontpage

10 December 2009 at 5:38am
I dont use the htmlwidget, so I dont know to help you.
BTW: I made update to the WidgetsManager plugin.
| 7538 Views | ||
| Go to Top | Next > |


