I have a holder page and its child page where i am inserting text and images.
Tt the moment i am displaying only the images from child page in the holder page.
this much is working fine.
Things need to be done
I want to randomly display image and first line of the text inserted in three child pages in my homepage
my code are
Holder page name is Horses.php
<?php
class Horses extends Page {
static $db = array(
);
static $has_one = array(
);
static $allowed_children = array('HorsesPage');
}
class Horses_Controller extends Page_Controller {
public function GetHorsesPage(){
return DataObject::get("HorsesPage");
}
}
?>
Child page name is HorsesPage.php
<?php
class HorsesPage extends Page {
static $db = array(
);
static $has_one = array(
'Photo' => 'Image'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Images", new ImageField('Photo'));
return $fields;
}
static $defaults = array(
'ShowInMenus' => false
);
static $allowed_children = array('none');
}
class HorsesPage_Controller extends Page_Controller {
}
?>
Example Code will be of great help i am new for silverstripe.
Thank you in advance