By Mariano.o on
Hello.
Currently I am working on this site.
I am trying to display a flash animation on the header, but it actually only works for the frontpage.
Any idea about how to make it work for the rest of the site?
Moreover, I wanted to use an animation which depends on a txt file. That means that the file.swf and file.txt should be placed on the same folder. I tried that, but nothing was displayed.
Thank for your help.
Comments
hard to see
It's hard to see why the flash header is not loading. How did you include it in the fromt page? I'd say, if you want the same header on every single page, the best place to put it in in page.tpl.php. If you place it there (make sure it's not within IF statements or other conditional code) it should show up on every page.
The txt file issue might be caused by a wrong url, so the swf can';t find the txt file. It can be hard sometimes to determine from which folder the swf tries to load external files. I use a firefox plugin called liveHTTPheaders (https://addons.mozilla.org/nl/firefox/addon/3829) to debug issues like this. It shows you exactly which files the swf tries to load.
Ok. Thanks for your help
Ok. Thanks for your help marcvangend!
Actually I included the swf in page.tpl.php. Didn't actually see it was within an if statement. I changed that and now it displays nicely on every site. I'll try your suggested add-on for firefox and I'll let you know if I can solve the issue with the required text file.
Thanks again.
You're welcome. Thanks for
You're welcome. Thanks for the feedback, and please let us know when the txt issue is solved (or not).
Hi, I'm trying to find an if
Hi, I'm trying to find an if statement so that I can limit the appearance of some flash that is built into page.tpl.php just to the home page. Do you recall how you did this? thanks!
----------------------------------------------------------------------
http://www.bwv810.com/
I am a writer and researcher. In my spare time I build websites with Drupal.
Je peux communiquer en français. / Я могу общаться на русском языке.
You have a CMS, use it
If want your swf only on the home page, I would not recommend to include it in page.tpl.php. You can never be 100% sure which changes you want to make later on, so I always try to build my sites as flexible as possible. (When you are building a page for a customer, or when others will have to maintain the site, this is even more important.)
My advice would be to create a block containing the swf and create a block region in your template. Then publish the block in that region and set it to appear on the homepage only. If the desired position of your swf is somewhere in the content area, together with other content, the panels module would be a good option.
Similar problem
My Flash header isn't showing up at all. It shows up when I test it locally but not from the web server. I'm thinking there is something I'm missing. So here is a snippet from my page.tpl.php file. The SWF is called header-b.swf and is in a /pics directory located in the same directory as the page.tpl.php file. Thanks in advance.
Did you try an absolute path
Did you try an absolute path to the swf file? (like http://www.yoursite.com/themes/yourtheme/pics/header-b.swf)
Yes I should have mentioned
Yes I should have mentioned that in the post. I did try that. I also checked all css associated with the header in the template to make sure nothing was blocking it with anything crazy like a z-index or something.
Thanks for checking.
Flash in css
My header graphic prior was just a jpg which was loaded from the css id. Is there a way to do the same with a SWF? I'd think there would be too much code involved. This is driving me crazy.
I use SWFObject, rather than
I use SWFObject, rather than AC_FL_RunContent, so I don't know anything about it. Does it need to call an external .js file to work properly? I know if I don't have my swfobject.js file in my header it can cause this type of problem.
SWFObject
Is that a module? I'm wondering if Drupal needs something special to recognize SWFs. Thanks for the tip.
SWFObject
It seems to only be available for Drupal 4 and I'm using 5.
I tried installing SWFUpload hoping that might help but I get this error on my log.
SWFUpload Missing files
You must install the minimalistic SWFUpload library to modules/swfupload/swfupload.
The error links to http://swfupload.mammon.se/ which brings up this error:
Site Temporarily Unavailable
We apologize for the inconvenience. Please contact the webmaster/ tech support immediately to have them rectify this.
error id: "bad_httpd_conf"
I just want to embed a SWF in my page template.
No, I don't use the module.
No, I don't use the module. I haven't even looked at it.
Do this...
<head>of your page.tpl.php using php to include the path to your theme (see http://agaricdesign.com/path-to-theme)That should be it. It may seem complicated now, but it's really quite quick & easy once you get the hang of it. Here's the generic snippet for .swf inclusion to modify for your needs:
wow thanks
I still don't have it working but I have my SWF and swfobject.js files in my theme directory. I have my call to the .js file in the page.tpl.php file like so
I added the code and modified it accordingly. I read the path to theme bit but my theme template, the SWF and swfobject.js file are all in the same directory. Maybe this is what I'm doing wrong?
Thanks a bunch for your response.
Got it
I used absolute path again and coupled with everything else you just showed me it works great now. Thank you so much monstordh.
- Scott
Glad to hear it's
Glad to hear it's working.
FYI - your path to call the swfobject.js should look like this:
<script src="<?php echo base_path() . path_to_theme() . "/swfobject.js"; ?>"and your call to your .swf file should look similar to this:
var fo = new FlashObject("<?php echo base_path() . path_to_theme() . "/my_flash.swf"; ?>", "blc_flash", "750", "300", "6");you may have forgotten to include the leading
"/"before your filename. These code snippets will ensure your paths are correct whether you keep your site at its current location or if it gets moved. Glad you got it working...monstordh, thanks for the
monstordh, thanks for the code. I can't seem to get it to work
Can you please post 1 complete block of code including the call to swfobject.ds AND the call to the .swf file ?
My drupal is in a folder on my server called portal
How would I set the absolute drupal path to the swf header ?
Your absolute path would be
Your absolute path would be http://www.yoursite.com/portal/themes/yourtheme/pics/yourswf.swf) assuming the swf is in a folder called pics within your theme folder like mine is.
Also you wrote swfobject.ds . Make sure its swfobject.js as in javascript. That could be your problem.
Hope that helps.
My call to the swfobject.js
rolandk - I personally don't advise an absolute path, incase you move something. Let php do your work for you.
My call to the swfobject.js file is complete in the above post. Here is a complete call to the .swf file:
Still Confused
Is all this code being added to the file page.tpl.php within sites/all/themes/my_theme? you say to put the swf. where I want it - I am not exactly sure where that is?
thanks!
Solution with block
You can use the new swfobject v2 from http://code.google.com/p/swfobject/ .
All you have to do is include the script swfobject.js in your theme an then from a block do the following :
Write the following code and set the block filter to php :
I have my flash file in my theme directory you can put it even in the files directory if you want.
I use drupal 6 but I think that this works from D5 too.
Hope it works.
hi there ppl :) i use drupal
hi there ppl :)
i use drupal 6 to and want to include flash in a block but having problems, anyhow was following the instructions added to the head of my page.tpl.php in the theme i'm using the following:
original "head" of page.tpl.php:
line added to "head":
final new head:
is that correct? then i went to my block, told it to use php filter and added the following:
I put my flash.swf and the swfobject.js in the theme directory where the page.tpl.php is located, in which i edited the head section.
One question though about the part i add to the block, the "path_to_your_flash" has to be what exactly, the absolute path like "http://mysite/themes/garland/flash.swf" so like this:
or somehow different? any tips what i'm doing wrong?
thx in advance :)
problems with internet explorer
ok got it working now, but only in firefox, in IE the display is not working, no flash and the block is somehow moved somewhere
original "head" of page.tpl.php:
I tried 3 different changes, number 1:
also tried, number 2:
and this one, number 3:
added this to block and turned on php filter:
all three versions of the changed page.tpl.php i get the same results, the flash in the block is displayed correctly and at the right place in firefox but in IE, flash is not displayed at all and the block is moved, how to get it displayed and working right in IE 6&7?
thx in advance
flash in durpal 6 block for firefox and IE 6 & 7
ok took a different approach, which works now, first edit page.tpl.php which is at yoursite/themes/yourtheme/page.tpl.php
original "head" of page.tpl.php for my case ('site/themes/garland/page.tpl.php'):
new head:
as we specified
'src="/themes/garland/foo.js"'we need to create a file called 'foo.js' and upload it to 'site/themes/garland/the content of my 'foo.js'
basically there are three functions in the 'foo.js' because i have three flash files, which i use as menus, and i have three languages, so i wanted the right flash menu loaded according to the language, i added as parameters to be high quality and transparent background, u can add what u want of course...
then u only need to include the following code in your block body and enable full html filter:
the
'<div align="center">'is there because i wanted the flash menu to be displayed in the middle of the blockfor more information take a look at:
http://www.adobe.com/devnet/activecontent/articles/devletter.html
anyhow would be nice to know why the other stuff i posted didn't work, if some1 knows how and why please respond, thx in advance :)
In the last post
In the last post (grooverider - April 25, 2008 - 05:25),
then u only need to include the following code in your block body and enable full html filter:
I don't know by that does it mean put the code >> in the block.tpl.php << or >> drupal site/admin/build/block & create a block?
Someone please go into a little more with specifics.
ALSO, does anybody have working examples of these page / block / node.tpl.php that we can look at and share the working code.
Please post links or an addendum to grooverider's pretty complete post.
Thank you.
reply
In the last post (grooverider - April 25, 2008 - 05:25),
then u only need to include the following code in your block body and enable full html filter:
I don't know by that does it mean put the code >> in the block.tpl.php << or >> drupal site/admin/build/block & create a block?
I meant the second part drupal site/admin/build/block & create a block and enable full html filter there, nothing in the block.tpl.php, you do not need to do any changes in any *tpl.php except the page.tpl.php
i have implemented this in this site http://jj-consulting.org
another way of doing it
this worked out better for me, anyone else tried something and had success?
create new block:
adminster-->block-->add block-->block body:
Adjust the parameters according your need in the example above width, height etc... my swf file is called flashvlu.swf, I use absolute paths to give its locations as you can see in the example above
src','http://yoursite.com/themes/garland/flashvlu'and'movie','http://jj-consulting.org/themes/ifeeldirty/flashvlu', but you do not include the extension as you can see above. You can put the *.swf file anywhere just adjust the path accordingly and make sure it is accessible through the web.Also don't forget to set the "input format" to "full html" when creating the block in the admin menu.
Next, we need to adjust the page.tpl.php, but only the head section, we have to upload an "AC_RunActiveContent.js" and an "AC_ActiveX.js" to your webspace. Their content is given at the bottom and can simply be copied and pasted (taken from adobe.com). You can upload them anywhere on you webserver, just adjust the path to them accordingly in the "page.tpl.php"
original head of page.tpl.php:
modified head of page.tpl.php:
below you can find the content of the AC_RunActiveContent.js and the AC_ActiveX.js these are just a matter of copy and paste into file and put it somewhere accessible on your webserver
content of AC_ActiveX.js:
content of AC_RunActiveContent.js:
this is great! Help
Thanks alot