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.

All other Modules /

Discuss all other Modules here.

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

Please Help in Widget


Go to End


1099 Views

Avatar
webcook

Community Member, 20 Posts

29 May 2009 at 10:13pm

Edited: 29/05/2009 10:14pm

Hi,
<br >Am new for developing widget in silver stripe.
<br >using the below coding am generate the story widget.
<br >It works perfectly but i cant able to see those values in pages.
<br >
<br >I dont know how to create Story Holder page.What is the use of Holder page. how to map the holder page with widget.
<br >
<br >
<br >
<br >class StoryWidget extends Widget {
<br > static $db = array(
<br > 'StoryTitle' => 'Varchar(255)',
<br > 'Content' => 'Text',
<br > 'StoryDate' => 'Date'
<br > );
<br >
<br > static $title = 'New Story';
<br > static $cmsTitle = 'Story Content';
<br > static $description = 'Adds HTML content to the widget sidebar. <br />(Save and refresh the page if you cannot see the text editor field.)';
<br >
<br > function Title() {
<br > return $this->WidgetTitle ? $this->WidgetTitle : self::$title;
<br > }
<br >
<br > function Output() {
<br > $output = new DataObjectSet("storywidget");
<br > $return_value = $output->groupBy('ID');
<br > return $return_value;
<br > }
<br >
<br > function getCMSFields() {
<br > $fields = new FieldSet();
<br > $fields->push(new TextField('StoryTitle'));
<br > $fields->push(new TextareaField('Content', 'Story description'));
<br > $fields->push(new DateField('StoryDate', 'Story date 01/01/1900'));
<br > return $fields;
<br > }
<br >}
<br >
<br >Thanks
<br >G