hello
i have created a page holder and a child page type,i am displaying random child in the holder page and it is working fine( got help from one of the thread) but now i need to display random 3 child in my homepage,help me out in doing that ,my code for the pages are
TouristplaceHolder.php
<?php
class TouristplaceHolder extends Page {
static $db = array(
);
static $has_one = array(
);
}
class TouristplaceHolder_Controller extends Page_Controller {
public function RandomChildren($max = 3)
{
return DataObject::get("TouristPlace","ParentID = $this->ID","RAND()",null,"0,$max");
}
}
?>
TouristPlace.php
<?php
class TouristPlace 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
);
}
class TouristPlace_Controller extends Page_Controller {
}
?>
TouristplaceHolder.ss
<% control RandomChildren %>
Random title: $Title
Photo:$Photo
<% end_control %>
the above code is working fine for me .what i need to do is to display random 3 TouristPlace pages in my home page
thank you in advance