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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

Blog and modules in home page?


Go to End


4 Posts   1856 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, 5523 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, 5523 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.