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.

All other Modules /

Discuss all other Modules here.

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

Please Help in Widget


Reply


630 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