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

Testimonial page error


Reply


431 Views

Avatar
ravik

Community Member, 10 Posts

22 June 2012 at 11:34pm

hi,

I am using silverstripe v2.4.7 , it is working fine. now i want to incorporate Testimonial page for my cms.
for that i have created a page Testimonial.php and i put the page into mysite/code folder

<?php

class Testimonial extends Page
{
   static $db = array (
      'Date' => 'Date',
      'Author' => 'Text',
      'Quote' => 'HTMLText'
   );

   static $has_one = array (
      'TestimonialPage' => 'TestimonialPage'
   );

   public function getCMSFields_forPopup()
   {
      return new FieldSet(
         new CalendarDateField('Date'),
         new TextField('Author'),
         new TextareaField('Quote')
      );
   }
}
class Testimonial_Controller extends Page_Controller{
}
---------------------------------------------------------------------------------------------
Then i have created one more page called TestimonialPage.php and i put the page into mysite/code folder

<?php

class TestimonialPage extends Page

{
   static $has_many = array (
      'Testimonials' => 'Testimonial'
   );

   public function getCMSFields()
   {
      $f = parent::getCMSFields();
      $f->addFieldToTab("Root.Content.Testimonials", new DataObjectManager(
         $this,
         'Testimonials',
         'Testimonial',
         array('Date' => 'Date','Author'=>'Author','Quote' => 'Quote'),
         'getCMSFields_forPopup'
      ));
      return $f;
   }
}

class TestimonialPage_Controller extends Page_Controller {
}

-------------------------------------------------------------------------------------------------------------------------
after that i build, and i logined to admin, there i select the Testimonials page in the dropdown list and click on the go button
here page is created in the sitetree called Testimonial but
the TAB Testimonial is not displaying

Please help me, its very urgent for me.