Closed (fixed)
Project:
SWFObject API
Version:
5.x-1.1
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
4 Jun 2007 at 12:02 UTC
Updated:
11 Mar 2009 at 09:53 UTC
Just try to get it working in a Drupal 5.1 site.
I have this in my page.tpl.php:
$url = 'http://sandbox/public/themes/themename/images/flashmovie.swf'; //path to flash file
$params = array(
'width' => 849,
'height' => 132
);
/*$vars = array(''
'file' => base_path() . path_to_theme() .'/files/song.mp3',
'image' => base_path() . path_to_theme() './files/image.jpg',
);*/
print theme("swfobject_api", $url, $params, $vars);
and I get this output:
<div id='flashcontent-flashmovie'>Sorry, you need to install flash to see this content.</div>
<script>var so = new SWFObject('http://sandbox/public/themes/themename/images/flashmovie.swf', 'movie', '849','132','flashmovie');
$(document).ready(function () { so.write("flashcontent-flashmovie");}); </script>
Comments
Comment #1
hanskuiters commentedAnd an error in de concole:
Error: SWFObject is not defined
Comment #2
hanskuiters commentedIf I call the swfobject.js directly in the page.tpl.php, as stated in http://drupal.org/node/126594, I get the error in console: $ is not defined
Comment #3
arthurf commentedPlease try the DRUPAL-1--1-2 version and check to see that the swfobject.js file is accessible
Comment #4
Devis commentedI had the same problem, solved adding
drupal_add_js(drupal_get_path('module', 'swfobject_api') .'/swfobject.js');in my template.php.
In my opinion you can't call drupal_add_js in the page.tpl.php, this should be called before $scripts gets generated.
Comment #5
arthurf commentedI'm curious about the need for doing this- and am wondering if the issue going on is actually caching. If caching is turned on, it could be the case that Drupal would not be making the call to render the swf again for users being served cache content. This would prevent the the drupal_add_js() call from being executed. So- is your caching on?
Comment #6
Devis commentedNo I don't use caching. In my opinion calling print theme("swfobject_api", $url, $params, $vars) inside page.tpl.php is too late to put swfobject.js in the html header; there should be something that calls that drupal_add_js before the template file is loaded.
Comment #7
arthurf commentedThere is a fix for this in the latest release. Should be resolved.
Comment #8
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #9
brunodboI'm still having this problem. Tried solving it with Devis' solution (#4), but it didn't work.
This is what's in my node.tpl.php:
This is what's outputted:
Comment #10
arthurf commentedDo you have any javascript warnings on that page?
Comment #11
brunodboSeems like I was mixing up module & swfobject versions. Sorry 'bout the noise.
Comment #12
arthurf commentedNo worries, I just wanted to make sure everything was ok.
Comment #13
ryosaeba commentedDear friends
I've the same problem here
http://www.walterfantauzzi.com/node/60
How Can I resolve it?