Question

Flash (swf file) into a Drupal Homepage

I am building a Drupal site and want to put a flash header on the home page.  I keep embedding the swf file in this file (page.tpl.php) but the movie does not run.  Only a white image appears that represent the swf.  Below is the regular code from drupal.  How do I embed the swf file?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language->language ?>" xml:lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>">
 
<head>
 
  <title><?php print $head_title ?></title>
  <?php print $head ?>
  <?php print $styles ?>
  <?php print $scripts ?>
  <script type="text/javascript"><?php /* Needed to avoid Flash of Unstyle Content in IE */ ?> </script>
  <script src="../../../../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
 
<body>
 
<!-- Main Container Starts Here -->
<div class="main-container">
	<div class="container">
		<div class="header">
		
		  <div class="logo">
				<?php if ($logo) { ?><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><img src="<?php print $logo ?>" alt="<?php print t('Home') ?>" /></a><?php } ?>
		  </div>
			<div class="slogan">
				<?php if ($site_slogan) { ?><?php print $site_slogan ?><?php } ?>
			</div>
			<div class="search-box">
				<?php if ($search_box) { ?><?php print $search_box ?><?php } ?>
			</div>
	  </div>
		<div class="leftbar">
			<?php if (isset($secondary_links)) { ?>
				<?php print theme('links', $secondary_links, array('class' =>'links', 'id' => 'subnavlist')) ?>
			<?php } ?>
	        <?php if (isset($primary_links)) { ?>
				<?php print theme('links', $primary_links, array('class' =>'links', 'id' => 'navlist')) ?>
			<?php } ?>
			<?php print $left; ?>
		</div>
		<div class="right-area">
			<div class="top-image">
				<div class="site-name">
					<?php if ($site_name) { ?><h1 class='site-name'><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><?php print $site_name ?></a></h1><?php } ?>
				</div>
			</div>
			<div class="content-area">
	 
				<?php if ($mission) { ?><div id="mission"><?php print $mission ?></div><?php } ?>
				  <div id="main">
					<?php print $breadcrumb ?>
					<h1 class="title"><?php print $title ?></h1>
					<div class="tabs"><?php print $tabs ?></div>
					<?php print $help ?>
					<?php print $messages ?>
					<?php print $content; ?>
					<?php print $feed_icons; ?>
				  </div>
			</div>
		</div>
	</div>
</div>
<!-- Mian Container Ends Here -->
<div class="footer">
	<div class="footer-info">
	<?php print $footer_message ?>
	Powered by Drupal, Design and Developed by <a href="http://www.livewirewebsolutions.com" target="_blank">Livewire Web Solutions Inc.</a>,	</div>
</div>
<?php print $closure ?>
</body>
</html>

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-08-25 at 18:54:29ID24681895
Tags

Drupal

,

Flash

,

swf

Topics

Drupal

,

Adobe Flash

Participating Experts
2
Points
325
Comments
8

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. embed .swf in .fla
    Hi, I am trying to embed .swf files in .fla file. I tried to follow the following instructions but it did not seem to work. In particular I could not find the field "instancename" mentioned in step #4 named 1. Create a new empty movieclip. Either by going to the m...
  2. Embed a Flash file (SWF or FLA) into another
    Hi, I would like to know if it were possible to embed into a Flash file (not just load at runtime) an other Flash movie (so the result will be a single file) and to interact with the embedded movie. Ideally, the second file (the file to embed) will be in SWF format or - if n...
  3. Embed SWF movies in a generic player
    Hello, I have four swf movies that I need to embed into a webpage. They don't have any controls on them, they're just movies. Is there a generic "player" out there that I can load the movies into so there are pause, stop and play buttons? Additionally, is there ...
  4. Embed a Flex SWF into a Flash SWF (not load at runtime)
    Hi, I would like to know how to embed a Flex developed application into a FLA Flash file (not just load at runtime), so the result will be a single SWF file and to interact with the embedded movie (play, stop, get and set variables). Ideally, the flash SWF will be compiled ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: stephencolsonPosted on 2009-08-25 at 20:12:42ID: 25184181

Your javascript paths are wrong. Think of the page.tpl.php as really existing at the root of the webserver or at whatever level they get called at. To clarify, if someone accessed your home page, the page template would seem to be located at your site root for purposes of calculating relative directories. If you had a page located at the URL /about/contact-us, then page.tpl.php should refer to supporting assets relative to that URL.

At the end of the day, this really suggests that you can't refer to browser-rendered support files in a purely relative manner. You need to refer to them in a full root-relative context. So instead of:
../../../../Scripts/AC_RunActiveContent.js

You should have:
/Scripts/AC_RunActiveContent.js

Assuming your Scripts directory is in your Drupal root

 

by: DJmusicPosted on 2009-08-26 at 06:06:18ID: 25187105

livewirewebsolutions,

here are instructions on how to embed flash videos in your page, using the javascript function AC_RunActiveContent.js: http://drupal.org/node/80776#comment-148713.
There are also third-party players that can be used to display flash videos and other. I personally use the Flowplayer module (http://drupal.org/project/flowplayer) but this page (http://drupal.org/node/133611#comment-1045051) directs to another one.

I hope it helps. Let me know if more info is needed.

DJ

 

by: livewirewebsolutionsPosted on 2009-08-27 at 06:06:53ID: 25197551

I don't know if this makes a difference but......this is just a flash file.  I do not want this displayed like a movie with the play button etc...  Does this matter?

 

by: DJmusicPosted on 2009-08-27 at 06:26:32ID: 25197827

livewirewebsolutions,

it does matter. Although players such as Flowplayer can be setup to not display the controls, it may be an overkill.
So it seems that the first link (http://drupal.org/node/80776#comment-148713) is the way for you to go. I have never tried that way but mac-perlinski (the author of the comment at drupal.org) posted a code snippet that display how to insert a flash video in page.tpl.php. It requires the definition of 2 javascripts (AC_RunActiveContent.js and AC_ActiveX.js), and then the cal to AC_RunActiveContent().
I'd be glad to try the code myself to make sure it works, and to guide you through if you want.

DJ

 

by: livewirewebsolutionsPosted on 2009-08-27 at 10:16:03ID: 25200562

Hi DJ Music,

That would be great.  Where do you put the js files.  In the scripts folder?  Anyway, if you could guide me through that would be great.

Thanks so much.

 

by: DJmusicPosted on 2009-08-27 at 16:13:43ID: 25203489

livewirewebsolutions,

it took me a little longer to troubleshoot the method but it works. Here's how to use the two javascript functions to insert SWF files in your template. First, the proof: http://vicbc.vanderbilt.edu/drupaltest. The ugly rolling picture is a SWF file (it worked on Firefox 3.5, IE8 and Safari 4, all on PC with Vista).

1- get the javascripts AC_RunActiveContent.js and AC_ActiveX.js. They are part of this archive (from Adobe site): http://download.macromedia.com/pub/developer/activecontent_samples.zip
2- copy the 2 javascript files in the folder "includes" of your drupal root directory
3- edit your theme page.tpl.php to add in the "<head>" section the following two lines (I inserted them right before the "</head>" tag):

<script src="/drupaltest/includes/AC_RunActiveContent.js" type="text/javascript"></script>
<script src="/drupaltest/includes/AC_ActiveX.js" type="text/javascript"></script>

4- wherever in the code where you want to insert the SWF file, use this code:

echo "<script type='text/javascript'>AC_FL_RunContent('codebase','http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','width','766','height','129','src','/drupaltest/sites/default/files/workshop1','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','/drupaltest/sites/default/files/workshop1','wmode','transparent');</script>";

T
his calls the function which will display the SWF file. On an important note, you need to specify your real path to your movie, starting from your drupal directory name (mine was "drupaltest") and you have to OMIT the file extension. Then, you can play with the width, height, etc to parametrize the display.

I also copy the full page.tpl.php code below. I used the one in the pushbutton theme. And it should work nicely. It did for me. Let me know if you have any troubles.

DJ

<?php
// $Id: page.tpl.php,v 1.25.2.2 2009/04/30 00:13:31 goba Exp $
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language->language ?>" xml:lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>">
<head>
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <?php print $head ?>
  <title><?php print $head_title ?></title>
  <?php print $styles ?>
  <?php print $scripts ?>
<script src="/drupaltest/includes/AC_RunActiveContent.js" type="text/javascript"></script>
<script src="/drupaltest/includes/AC_ActiveX.js" type="text/javascript"></script>
</head>
 
<body>
<div class="hide"><a href="#content" title="<?php print t('Skip navigation') ?>." accesskey="2"><?php print t('Skip navigation') ?></a>.</div>
 
<table id="primary-menu" summary="Navigation elements." border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td id="home" width="10%">
      <?php if ($logo) : ?>
        <a href="<?php print $front_page ?>" title="<?php print t('Home') ?>"><img src="<?php print($logo) ?>" alt="<?php print t('Home') ?>" border="0" /></a>
      <?php endif; ?>
    </td>
 
    <td id="site-info" width="20%">
      <?php if ($site_name) : ?>
        <div class='site-name'><a href="<?php print $front_page ?>" title="<?php print t('Home') ?>"><?php print($site_name) ?></a></div>
      <?php endif;?>
      <?php if ($site_slogan) : ?>
        <div class='site-slogan'><?php print($site_slogan) ?></div>
      <?php endif;?>
    </td>
    <td class="primary-links" width="70%" align="center" valign="middle">
      <?php print theme('links', $primary_links, array('class' => 'links', 'id' => 'navlist')) ?>
    </td>
  </tr>
</table>
 
<table id="secondary-menu" summary="Navigation elements." border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td class="secondary-links" width="75%"  align="center" valign="middle">
      <?php print theme('links', $secondary_links, array('class' => 'links', 'id' => 'subnavlist')) ?>
    </td>
    <td width="25%" align="center" valign="middle">
      <?php print $search_box ?>
    </td>
  </tr>
  <tr>
    <td colspan="2"><div><?php print $header ?></div></td>
  </tr>
</table>
 
<table id="content" border="0" cellpadding="15" cellspacing="0" width="100%">
  <tr>
    <?php if ($left != ""): ?>
    <td id="sidebar-left">
      <?php print $left ?>
    </td>
    <?php endif; ?>
 
    <td valign="top">
      <?php if ($mission != ""): ?>
      <div id="mission"><?php print $mission ?></div>
      <?php endif; ?>
 
      <div id="main">
        <?php if ($title != ""): ?>
          <?php print $breadcrumb ?>
          <h1 class="title"><?php print $title ?></h1>
 
          <?php if ($tabs != ""): ?>
            <div class="tabs"><?php print $tabs ?></div>
          <?php endif; ?>
 
        <?php endif; ?>
 
        <?php if ($show_messages && $messages != ""): ?>
          <?php print $messages ?>
        <?php endif; ?>
 
        <?php if ($help != ""): ?>
            <div id="help"><?php print $help ?></div>
        <?php endif; ?>
 
      <!-- start main content -->
      <?php print "<br>HELLO!!!!!<br><br><br>";
 
/*You embed your flash movie using the following function you can place
the following code in page.tpl.php or inside the content of your node*/
echo "<script type='text/javascript'>AC_FL_RunContent('codebase','http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','width','766','height','129','src','/drupaltest/sites/default/files/workshop1','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','/drupaltest/sites/default/files/workshop1','wmode','transparent');</script>";
print "<br><br><br>";
 
	  print $content; ?>
      <?php print $feed_icons; ?>
      <!-- end main content -->
 
      </div><!-- main -->
    </td>
    <?php if ($right != ""): ?>
    <td id="sidebar-right">
      <?php print $right ?>
    </td>
    <?php endif; ?>
  </tr>
</table>
 
<table id="footer-menu" summary="Navigation elements." border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td align="center" valign="middle">
    <?php if (isset($primary_links)) : ?>
      <?php print theme('links', $primary_links, array('class' => 'links primary-links')) ?>
    <?php endif; ?>
    <?php if (isset($secondary_links)) : ?>
      <?php print theme('links', $secondary_links, array('class' => 'links secondary-links')) ?>
    <?php endif; ?>
    </td>
  </tr>
</table>
 
<?php if ($footer_message || $footer) : ?>
<div id="footer-message">
    <?php print $footer_message . $footer;?>
</div>
<?php endif; ?>
<?php print $closure;?>
</body>
</html>
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:

Select allOpen in new window

 

by: livewirewebsolutionsPosted on 2009-08-28 at 04:56:36ID: 25206592

Hey DJ Music,
The code worked brilliantly.  Awesome help to.  I worked on it for about an hour getting it right.  Almost gave up and at the last second I got it.  Your instructions and code work perfectly.  Your an asset to this site.
Cheers.

 

by: DJmusicPosted on 2009-08-28 at 05:56:27ID: 25207035

livewirewebsolutions,

thanks for your kind words. I'm just thrilled I was able to help!

have a good one,

DJ

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...