hi, mi English in to poor, but im going to try you understand me.
i have a gallery holder whitch contains multiple gallerys with images.
In my galery holder i want to show the title and an image of each galery, the image linked to the gallery.
The Link an Name of each galery y can get with control children.
but the problen comes when i want to show a image of the gallery, i cant figured how to get this image.
here are my classes:
HolderGalerias
class holderGalerias extends Page {
static $db = array(
);
static $has_one = array(
);
static $allowed_children = array('Galeria');
}
class holderGalerias_Controller extends Page_Controller {
function getGalerias(){
if(!isset($_GET['start']) || !is_numeric($_GET['start']) || (int)$_GET['start'] < 1)
$_GET['start'] = 0;
$SQL_start = (int)$_GET['start'];
$doSet = DataObject::get(
$callerClass = "Galeria",
$filter = "",
$sort = "",
$join = "",
$limit = "{$SQL_start},2"
);
return $doSet ? $doSet : false;
//return $doSet->fotos();
}
}
Galeria
class Galeria extends Page {
static $has_many = array (
'FotosGal' => 'imagenesGaleria',
);
static $db = array(
);
static $has_one = array(
);
public function getCMSFields(){
$f = parent::getCMSFields();
$manager = new ImageDataObjectManager(
$this, // Controller
'FotosGal', // Source name
'imagenesGaleria', // Source class
'Photo', // File name on DataObject
array(
), // Headings
'getCMSFields_forPopup' // Detail fields
// Filter clause
// Sort clause
// Join clause
);
$f->addFieldToTab("Root.Content.Fotos",$manager);
return $f;
}
}
class Galeria_Controller extends Page_Controller {
function fotos() {
if(!isset($_GET['start']) || !is_numeric($_GET['start']) || (int)$_GET['start'] < 1) $_GET['start'] = 0;
$SQL_start = (int)$_GET['start'];
$doSet = DataObject::get(
$callerClass = "imagenesGaleria",
$filter = "`GaleriaID` = '".$this->ID."'",
$sort = "",
$join = "",
$limit = "{$SQL_start},8"
);
return $doSet ? $doSet : false;
}
}
imagenesGaleria
class imagenesGaleria extends DataObject{
static $db = array (
'Title' => 'Varchar(250)',
);
static $has_one = array (
'Galeria' => 'Galeria',
'Photo' => 'Imagen',
);
public function getCMSFields_forPopup(){
return new FieldSet(
new TextField('Title'),
new FileIFrameField('Photo')
);
}
}
any help would be apreciate!