AmateurCoder
AmateurCoder

Reputation: 4292

How can I use flash files in my SDL Tridion page?

My page is showing regular component presentations very well. I have a flash/video file in my local machine and i want to upload this file on my page. How can I achieve this?

I have this code snippet for rendering components on my page:

<!-- TemplateBeginRepeat name="Components" -->
    <!-- TemplateBeginIf cond="ComponentTemplate == 'HomePageCT'" -->
        @@RenderComponentPresentation()@@
    <!-- TemplateEndIf -->   
<!-- TemplateEndRepeat --> 

Please provide all details related to flash files and video files.

Upvotes: 1

Views: 475

Answers (3)

Alvin Reyes
Alvin Reyes

Reputation: 2887

There are several approaches to rendering Multimedia with a Tridion-managed page.

Multimedia components can be:

  1. Part of a component presentation, added to a page with a template selected
  2. As a linked-to multimedia component within a "container" component, which is added to a page
  3. In a rich text format (RTF) area within another component

You could also just publish binaries with dynamic component templates and handle the markup and links outside of Tridion. Get creative with the above basic scenarios depending on the markup and/or metadata you need.

Chris addresses #1 and Mihai explains schema setup and .AddBinary. The second option would be similar, except you'd have to get the referenced ID rather than the component on the page. The third option requires you to parse multimedia within RTF which depends on your templating language and multimedia type.

I've seen XSLT (<xsl:template match="">), grep, and various .replace options to parse specific markup such as Flash videos.

Upvotes: 1

Chris Summers
Chris Summers

Reputation: 10163

Placing a Flash file on a page follows exactly the same process as placing any image in the output of your templates. The steps are outlined below:

  1. Create a Multimedia Schema which allows the Flash multimedia type (e.g. Flash Video Schema)
  2. Upload your Flash file using your new Schema
  3. Create a Component Template to render the HTML you want to use to display the Flash file, and actually publish the binary itself. (e.g. Display Flash CT)
  4. Create a page template (you seem to have done this part) which renders the Page, and renders the Components on the page using @@RenderComponentPresentation()@@
  5. Create a Page, and place your Flash file on it using the Display Flash CT
  6. Publish the Page

Without details of the output you want to produce, it is hard to provide the sample Dreamweaver Template Building Block code for the DisplayFlash CT, but it might look something like this:

<embed src="@@Component.Id@@" allowFullScreen="true" width="540" 
    height="438" bgcolor="#000000" type="application/x-shockwave-flash"    
    pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed>

Make sure you use the Default Finish Actions TBB after this in your Component Template so that the src link is processed and the binary is published.

Upvotes: 9

Mihai Cădariu
Mihai Cădariu

Reputation: 2407

There is nothing special about Flash files with Tridion. They can be treated just like any other Multimedia Component. You can upload them into the CME (or by using Webdav) and thus you will have a Multimedia Component. Make sure of course, that you Multimedia Schema allows the Flash (and extension) as Multimedia Type.

Regarding how you put the Flash file on the Page - again just like a normal Multimedia Component. In your CT you have to generate the output that will make use of your Flash file URL somewhere. You will have to publish your Flash MMC in order to get its URL. You can use Engine.AddBinary or RenderedItem.AddBinary methods for that, or use the Publish Binaries in Package Default TBB, if your MMC is in the package. Then you can simply refer to your Flash URL as package item. Have a look at this URLs for some inspiration: http://yatb.mitza.net/2012/03/publishing-images-as-variants.html (your case doesn't have to be that complex) and http://yatb.mitza.net/2012/04/referencing-image-variants-from.html.

Upvotes: 5

Related Questions