17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1481 Views |
-
Change Flash

5 November 2008 at 1:59pm
Hi
I have a different Flash file for each of my pages (all of the same page type) but not in the content area - it is in a banner across the top.
If it were an image I could do it by extending the page with
static $has_one = array(
'Photo' => 'Image');Is there a way to do this for Flash i.e.
static $has_one = array(
'PhotoMontage' => 'Flash');Or am I barking up the wrong tree? Should I be doing it some other way?
Thanks
MM
-
Re: Change Flash

5 November 2008 at 9:41pm
Image just extends File, so you can do:
static $has_one = array(
'PhotoMontage' => 'File'
);An even simpler approach is to put all your flash files in the same asset folder, and then just use a Varchar to hold the filename - you don't even need a relationship in this case.
-
Re: Change Flash

5 November 2008 at 10:17pm
Hey Jam13
When I change to what you suggest
class Page extends SiteTree {
static $db = array(
);
static $has_one = array(
'PhotoMontage' => 'File'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.MyBannerImage", new ImageField("BannerImage"));
return $fields;
}I have in my Page.ss file
<div id="Heropics">
$PhotoMontage
</div>I get the error "The website server has not been able to respond to your request."
Any thoughts?
Thanks
MM
-
Re: Change Flash

6 November 2008 at 2:08am
I don't know whether using an ImageField for a File will work properly - I've no idea how it will behave when you upload a flash file. You should probably use either a FileField, or one of the FileTree fields (I forget the name off the top of my head, but you can check in the documentation).
Assuming you have got the backend working and have associated a file with the page, you'll need to render the flash file in the appropriate html. Because it's not an image, SilverStripe doesn't know how to render it automatically. Something like:
<embed height="200" width="300" type="application/x-shockwave-flash" wmode="transparent" src="$PhotoMontage.URL"/>
Although I would actually recommend using SWFObject (http://code.google.com/p/swfobject/) for embedding Flash movies rather than this untested code snippet.
-
Re: Change Flash

6 November 2008 at 3:23pm
Hi Jam13
Thanks for your help ... in the end I took your original advice and set-up files up as var.
Cheers
MM
| 1481 Views | ||
|
Page:
1
|
Go to Top |

