I want to display a Flash file from a view. I have a content type with a file field that I use to create a node and submit a Flash file (.swf).

Then I use a view to create a block showing the content of these content type nodes. I get the Flash files URL and use the code below to print it - but, no Flash is printed!

Why doesnt this work? It's HTML, isn't it? And Views should support it?

<embed id="[title]" width="190" height="285" wmode="transparent" loop="true" scale="noscale" allowscriptaccess="sameDomain" quality="high" bgcolor="#FFFFFF" name="[title]" src="[field_ad_flash]" type="application/x-shockwave-flash">
  • First, your tag is not closed : should be '/>' at the end. Did you check the source code of the page ? Is something incorrect output or is there nothing at all ?
    – Countzero
    Commented Feb 24, 2012 at 16:05
  • Oh, thanks. Yeah,and no code is printed if I have the code above saved in the view. If I just print a token, that is visible. Same thing if I add some random text before the <embed> code. It is visible. Commented Feb 24, 2012 at 17:02
  • OK, so it's because the embed tag is filtered at some point : not standard enough and probably considered unsecured. Here's a pretty hot thread about it : drupal.org/node/853880
    – Countzero
    Commented Feb 24, 2012 at 18:32

2 Answers 2


This is how I resolved this issue:

  1. I set up my view to only print the URL of the flash file.
  2. THen I created a views template for that specific field.
  3. In that template file i added the HTML above and printed the output - which is the flash files path - as src.
  4. Done!

I was using Views PHP for this purposes and of course you have to select url (path to file) to show in file field. Here is the code example (field-flash - an url to swf file and flash-image - it`s an image used when flash is disabled):

<?php if(isset($data->field_field_flash[0]['rendered']['#markup'])) {
     $flash= $data->field_field_flash[0]['rendered']['#markup']; 
if(isset($data->field_field_flash_image[0]['rendered']['#markup'])) {
     $flash_image= $data->field_field_flash_image[0]['rendered']['#markup']; 
<object type="application/x-shockwave-flash" width="240" height="400" id="movie" align="top" data="<?php print $flash; ?>" >
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="<?php print $flash; ?>" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="wmode" value="opaque" />
<img src="<?php print $flash_image; ?>" width="240" height="400" alt="movie" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.