Hi
Got a newbie question,
as am SS and php beginer somehow cant get this function to work.
<?php
class GalleryPage extends Page
{
static $has_many = array (
'GalleryImages' => 'GalleryImage'
);
public function getCMSFields()
{
$f = parent::getCMSFields();
$manager = new FileDataObjectManager(
$this, // Controller
'GalleryImages', // Source name
'GalleryImage', // Source class
'Resource', // File name on DataObject
array(
//'Thumbnail' => 'Image',
'Name' => 'Name',
'Caption' => 'Caption'
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);
$manager->setAllowedFileTypes(array('jpg','png','flv'));
$manager->allowUploadFolderSelection();
$f->removeFieldFromTab("Root.Content.Main","Content");
$f->addFieldToTab("Root.Content.Main", $manager, "Content_Caption");
return $f;
}
}
class GalleryPage_Controller extends Page_Controller {
public function IsFLV()
{
$res = $this->Resource;
$ext = $res->getExtension();
if ($ext == 'flv')
return true;
else
return false;
}
}
?>
what i want to do is to get the Resource(is a file) extension, find out if it is and flv and return boolean.
i know the above syntax isnt right, but cant figure out how it should be.
tried different ways, mostly the $res is empty, or the page wont load at all.
thanks