I have a page type TestimonalHolder
that has a page type Testimonials
as its children, each of which has a Message
$ db field to store testimonal.
The question is how can I access this field $Message
on mine HomePage.ss
, for example, so that I can skip them and put them in a slider, etc.
Testimonials.php
class Testimonials extends Page {
private static $db = array(
'Message' => 'Text'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldsToTab('Root.Testimonials', array(
TextareaField::create('Message')
));
return $fields;
}
}
class Testimonials_Controller extends Page_Controller {
}
I know that I can skip them using this code on my page TestimonialHolder.ss
:
<% loop $Children %>
<h2>$Title</h2>
$Message
<% end_loop %>
source
share