I'm new to programming and need a little (probably a lot) of help. I've been following a bunch of tutorials but can't seem to find what I want. I'm trying to extend my site to display testimonies on the homepage but can't figure out how to do it. I think I need a TestimonyHolder page to display the testimonies but am unsure of how I would access the dataobject there.
I am using ModelAdmin to display a tab in the admin section so a user can populate testimonies.
MyAdmin.php:
<?php
class MyAdmin extends ModelAdmin {
private static $managed_models = array(
'Testimonial'
);
private static $url_segment = 'testimonials';
private static $menu_title = 'Testimonials';
}
This is my Testimonial page:
<?php
class Testimonial extends DataObject {
private static $db = array(
'Date' => 'Date',
'Name' => 'Varchar',
'Business' => 'Varchar',
'Testimony' => 'Text'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$dateField = new DateField('Date', 'Testimonial Date (for example: 12/20/2010)');
$dateField->setConfig('showcalendar', true);
$dateField->setConfig('dateformat', 'MM/dd/YYYY');
$fields->replaceField('Date', $dateField);
return $fields;
}
public function canDelete($member = null) {
return Permission::check('CMS_ACCESS_MyAdmin', 'any', $member);
}
}
Thanks in advance!