Swf Tools: Missing flash content

Joined: 12/08/2008
User offline. Last seen 2 years 10 weeks ago.

I'm having trouble getting the swf tools player to show up. In a view if i set the "Content: Audio File" to "SWF Tools - no download link" the player shows up in that view. But viewing the Node itself and in the template using "print swf($node->field_audio_file[0]['view']);" I get the default "You are missing some Flash content that should appear here! Perhaps your browser cannot display it, or maybe it did not initialize correctly." from swf tools.

i'm stumped.

-jamie

Update: I just randomly changed the ['view'] to ['filepath'] and it worked. Dunno why, I would love to know :)

G&G Podcast Host
Rob Feature's picture
Joined: 06/01/2006
User offline. Last seen 10 weeks 1 day ago.
Here's what's happening:

Ok, first you taught me something new in Drupal here :) I had no idea that Views now has an option to print an SWF Tools player...that ROCKS (and never existed before). So, sweet! Beyond that, here's what's happening:

First, you have to separate your thinking between Views output and node display. Unless you choose "node" as the display type in Views, it's outputting fields individually...this has absolutely nothing to do with your node displays (ie. things like your template files, the content type "display fields" settings, etc). It's simply spitting out separate parts of your node individually.

Realizing this, it's no surprise that you get different results in your view vs. in your node display.

Moving onto your node display, SWF Tools must be themed into your template (as you obviously know)...it doesn't interact with "Display Fields" settings in the content types menu (although it should and I may have to get that fixed) This means that your "view" setting in Display Fields isn't going to spit out the proper format for the SWFTools theme function to use. The format it needs is the URL which is included in the ['filepath'] part of the array (that's why changing it made it work)

Technically, it's insecure to use ['filepath'] in this way...but if your staff will be the only ones adding audio to your site I wouldn't worry about it too much. Although this is technically a security concern, (because you're using raw, unsanitized user input) I don't see how a malicious script could be executed in this way. (although I'm sure a developer could correct me on that)

Hope that helps explain what's happening!

-Rob Feature
Geeks and God Co-Host
www.mustardseedmedia.com

Joined: 12/08/2008
User offline. Last seen 2 years 10 weeks ago.
aaah, ok. that makes more

aaah, ok. that makes more sense.

So what do I need to do to theme SWFtools into my template? Keep in mind this is my very first Drupal site. I hit a brick wall every 10 minutes it seems. I'd like to learn the proper way to set it up securely for future use.

-jamie

G&G Podcast Host
Rob Feature's picture
Joined: 06/01/2006
User offline. Last seen 10 weeks 1 day ago.
Change the "Display" setting

You should be able to use <?php print swf($node->field_audio_file[0]['view']); ?> to print your audio player IF you go into the content type's "Display Fields" setting (go to /admin/content/types, choose 'manage fields' for your type, then choose the 'display fields' tab) and set that to display a URL to the file. There's a couple different settings (and I don't remember which works off the top of my head), so try a few and it should work.

-Rob Feature
Geeks and God Co-Host
www.mustardseedmedia.com