SWFAddress D6 throws file-get-contents error

londian - November 21, 2008 - 11:52
Project:SWFAddress
Version:6.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)
Description

Hi, when using the latest release of SWFAddress with Drupal 6.6 I get the following error:


warning: file_get_contents(sites/all/modules/swfaddress/swfaddress-2.1/js/swfaddress-optimizer.js?swfaddress=test&base=%2Fflex%2Fmain.swf&flash=9.0.0) [function.file-get-contents]: failed to open stream: No error in C:\Program Files\wamp\www\puzhen.com\includes\locale.inc on line 1643.

Anyone have any idea what might be causing this?

I have SWFAddress is located at puzhen.com/sites/all/modules/swfaddress, my flash file is located at puzhen.com/flex/main.swf. SWFAddress 2.1 and SWFObject libraries are up to date and in the correct locations.

I am working in a local test setup; might this have anything to do with the problem?

#1

londian - November 21, 2008 - 12:08

Played around with it a bit more and the behaviour seems to be a bit random; sometimes it throws the error mentioned above, sometimes it doesn't. But it never correctly redirects to the SWF file.

Am I missing something really obvious here? Here are my current SWFAddress settings:

SWF Url = flex/main.swf (i also tried adding a leading slash, but it didn't make any difference

Base Path = flex (also with no setting here, same results)

Mode = Exclude, with default excluded paths

#2

Antyler - December 4, 2008 - 16:48

I'm having the same kind of issue.

My SWFAddress module contains two folders named swfaddress-2.1 (core distribution) and swfobject.

Help would be greatly appreciated.

#3

Antyler - December 5, 2008 - 00:34

Here's my situation,

So I have a standard installation of Drupal 6.6 with Services, AMFPHP Head and all, and this SWFAddress module (very neat btw). The thing is, when I activate Replacement, SWFAddress redirects me correctly to localhost/#someaddress but nothing shows up with SWFObject.

I found out that it's partly due to my installing Drupal somewhere else than in the root of the server, for SWFAddress adds the js files (swfaddress.js, swfobject.js, etc.) from a relative path (from the url mentionned above, it tried to load /drupal/modules/services/... where "drupal" is the folder of drupal).

Now I've tried to make a full install on the very root but the problem still remains, so I guess I must dig in the swfaddress.module to put absolute paths but I'm not sure it would be a good solution.

Any thought ?

#4

Antyler - December 5, 2008 - 01:30

Ok, the relative or absolute path were a wrong lead. Forget about my previous post.

Hell, the problem was simple : there was no div layer with the default "swf-replacement" id so it's logical nothing would show up. Now it all makes sense.

Go modify the page.tpl.php of the theme you have currently activated, by default yourdrupalinstall/themes/garland.

To make SWFObject work with the default id, you have to embed the whole page content into another div. Here I put the div before the wrapper.

<div id="swf-replace">
    <div id="wrapper">
        // template body
    </div>
</div>

If you want to put another id, change it in the tpl and in the module config page indeed.

The thing is, in this module config page, it's not all that clear as how the replacement occurs. I thought an id was to be given and the thing would be automatically done. It turned out not to be the case. Maybe in a further release you could add a hint in the help.

+

#5

Antyler - December 5, 2008 - 08:44

I'm not finished. :p

If by chance you set the SWFObject width and height to 100% in the SWFAddress config page, the above code is incomplete as it will show a blank page.

<style type="text/css" media="screen">
  html, body, { height:100%; }
  body { margin:0; padding:0; overflow:hidden; }
</style>

If you do want the html scroll bar to be visible on the right, erase "overflow:hidden".
*Edit* As I feared, using overflow:hidden is a good feature to hide the unwanted bar when you display the RIA but if you use it simply like that on page.tpl.php, you won't have a scroll bar when you want to administer your site either. And that is a bother.

You can paste the above code below the styles in the page.tpl.php

#6

carvalhar - February 27, 2009 - 14:10

hey,

i was having the same problemn and with your tips now i'm getting a blank page, but i can notice that my swf is loading somewhere, because my swf loads flickr photos and i can see the status bar loading the flickr url...so...it's there, but where?

do you have any idea?

#7

Steven Merrill - February 28, 2009 - 17:46
Status:active» postponed (maintainer needs more info)

Everyone,

There's way too much in here.

Let's talk about the core issue - the file_get_contents error. Is this still happening on Drupal 6.10?

(I now test this module locally now on a site not installed on the root to try to avoid errors with this module on non-root installations. It's working fine on my http://localhost/6testing/ site, so I don't think it has to do with running Drupal in a directory.)

It _shouldn't_ be, since I'm including all my JS through drupal_get_path calls:

<?php
    drupal_add_js
(drupal_get_path('module', 'swfaddress') .'/swfobject/swfobject.js', 'module');
   
   
// Add the two SWFAddress libraries.
   
drupal_add_js(drupal_get_path('module', 'swfaddress') .'/swfaddress-2.1/js/swfaddress.js', 'module');
   
drupal_add_js(drupal_get_path('module', 'swfaddress') . _swfaddress_optimizer('/swfaddress-2.1/js/swfaddress-optimizer.js?'), 'module',
     
'header', FALSE, FALSE);
?>

#8

garphy - November 13, 2009 - 13:31

Ok, the warning is still showing up, even after upgrading to the latest (1257985444) version. It required me to switch to swfaddress-2.4, so did I, but the warning is still there.
I think it appears on localized installations that make .js files pass through the localization mechanism.
The problem is it tries to locate the swaddress-optimize.js file on the disk with the url parameters appended and it doesn't find it (obviously). Maybe it'll be cleaner to add the line through a theme function, like the embeddSWF statement, to prevent going through this callback...

 
 

Drupal is a registered trademark of Dries Buytaert.