Hi All,
I hav Filedom up and working (local with Mamp). I can upload mp3 or flv, but instead of showin on the page, a link shows up. When i click the link, the mp3 plays in another window. When i click the flv link. Firefox ask to dowload.
here's my code
download.php
<?php
class Download extends DataObject
{
static $db = array (
'Naam' => 'Text',
'Omschrijving' => 'Text',
);
static $has_one = array (
'Bijlage' => 'File',
'DownloadPage' => 'DownloadPage'
);
public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('Naam'),
new TextareaField('Omschrijving'),
new FileIFrameField('Bijlage')
);
}
}
?>
downloadpage.php
<?php
class DownloadPage extends Page
{
static $has_many = array (
'Bijlagen' => 'Download'
);
public function getCMSFields()
{
$f = parent::getCMSFields();
$manager = new FileDataObjectManager(
$this, // Controller
'Bijlagen', // Source name
'Download', // Source class
'Bijlage', // File name on DataObject
array(
'Naam' => 'Name',
'Omschrijving' => 'Description',
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);
$f->addFieldToTab("Root.Content.Downloads",$manager);
return $f;
}
}
class DownloadPage_Controller extends Page_Controller {
function AllDownloads() {
return $this->data()->Bijlagen();
}
};
?>
downloadpage.ss
<div class="typography">
<h2>$Title</h2>
$Content
<% control allDownloads %>
<a href="$Bijlage.Filename">$Bijlage.FileName - $Bijlage.Size</a>
<p>$Omschrijving</p>
<% end_control %>
</div>
Note: I can only use $Bijlage.Filename. When i use just $Bijlage, i get a server error
Can somebody help me out.
Thanks