Here's my Dataobject code(SwfBannerResource.php)
<?php
class SwfBannerAdResource extends DataObject
{
static $db = array (
'AdName' => 'Text',
'Link' => 'Text'
);
static $has_one = array (
'Attachment' => 'Image', //Needs to be an image
'Swf' => 'File',
'SiteConfig' => 'SiteConfig'
);
public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('AdName'),
new TextField('Link'),
//new FileIFrameField('Attachment'),
new FileAttachmentField('Attachment', 'Static jpeg 1017px by 112px'),
new FileAttachmentField('Swf', 'Swf 1017px by 112px')
);
}
}
Here's my Site config (part of it)
public function updateCMSFields(FieldSet &$fields) {
$manager = new DataObjectManager(
$this->owner,
'SwfBanners',
'SwfBannerAdResource',
//'Swf',
array(
'AdName' => 'AdName',
'Link' => 'Link',
'Attachment.Name' => 'Attachment',
'Swf.Name' => 'Swf',
),
'getCMSFields_forPopup'
);
$manager->setParentClass('SiteConfig');
$manager->setSourceID($this->owner->ID);
/*
$manager->setUploadFolder("PublicationPage-" . $this->ID);
$manager->setAllowedFileTypes(array ('pdf','doc'));
*/
$fields->addFieldToTab("Root.SwfBanner", $manager);
And here's my template:
<% control SiteConfig %>
<% control SwfBanners %>
$Attachment
<div id="FlashContainer">
<a href="$Link">
$Attachment
</a>
</div>
<script type="text/javascript">
/* <![CDATA[ */
swfobject.embedSWF(
"$Swf.URL",
"FlashContainer",
"1017", "112",
"9.0.0",
"nzkier2/nzskier/js/swfobject/expressInstall.swf"
);
/* ]]> */
</script>
<% end_control %>
<% end_control %>
I haven't got randomizing yet, I'm just trying to loop thru all the SwfBanner data object and get them to display.
But only "/assets/" is output by the template even tho in the CMS i can see the files, urls, etc.
Any Ideas?
Thanks in advance