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.

Archive /

Our old forums are still available as a read-only archive.

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

Blog and modules in home page?


Reply


4 Posts   1585 Views

Avatar
knox

Community Member, 4 Posts

22 February 2008 at 5:41pm

Hi, i wish see the widgets (links, countdown, etc) in the home page but only can see after press the blog link.

?¿

help me please

thanks

Avatar
Willr

Forum Moderator, 5513 Posts

24 February 2008 at 5:16pm

You can have widgets on any page type by adding a WidgetArea to it. Open the page type code and add

static $has_one = array(
   "MyWidgets" => "WidgetArea"
);

then in the getCMSFields you will need to add the widget drag and drop system

function getCMSFields() {
   $fields = parent::getCMSFields();
   $fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("MyWidgets"));
   return $fields;
}

Then last but not least you need to open up your template file and add the code to render the widget area. In this example you would need to put $MyWidgets in the template some where.

Remember to db/build and then flush the page.

Avatar
knox

Community Member, 4 Posts

27 February 2008 at 6:25pm

Edited: 27/02/2008 6:28pm

Ok, but where is "page type"??

explain me please

thanks

Avatar
Willr

Forum Moderator, 5513 Posts

28 February 2008 at 10:36am

Rather then explain and give you the full solution its probably better if you actually read tutorial 1 and 2 - http://doc.silverstripe.com/doku.php?id=tutorials and get to under stand the basics first, Tutorial 2 should cover what you need to know for this.