Adding a SWF to the template using swfObject

If you'd like to use the swfobject.js file and method, you can read the full documentation here: documentation. But essentially, we're going to use the dynamic publishing option to include our SWF file.

1. Using the SWF file included in this book's code packet, create a new directory in your theme called flash and place the SWF file in it. Then, create a div with alternative content and a script tag that includes the following JavaScript:

<script type="text/javascript">

swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0"); </script>

<div id="myContent">

<p>Alternative content</p> </div>

2. Add this ID rule to your stylesheet (I placed it just below my other header and intHeader ID rules):

#flashHold{ float: right; margin-top: 12px; margin-right: 47px;

As long as you take care to make sure the div is positioned correctly, the object embed code has the correct height and width of your Flash file, and you're not accidentally overwriting any parts of the theme that contain WordPress template tags or other valuable PHP code, you're good to go.

What's the Satay method?

It's a cleaner way to embed your Flash movies while still supporting web standards. Drew McLellan discusses its development in detail in his article: This method was fine on its own until IE6 decided to include its ActiveX security restriction. Nowadays, a modified embed method called the "nested-objects method": flashembedcagematch/ is used with the swfObject JavaScript we just covered.

Good developer's tip:

Even if you loathe IE (as lots of us as developers tend to), it is an "industry standard" browser and you have to work with it. I've found the Microsoft's IE blog ( extremely useful in keeping tabs on IE so that I can better develop CSS-based templates for it. While you're at it, go ahead and subscribe to the RSS feeds for Firefox (, Safari (http://, and your other favorite browsers. You'll be surprised at the insight you can glean, which can be extremely handy if you ever need to debug CSS or JavaScripts for one of those browsers.

Was this article helpful?

0 0
Creating And Writing Your Blog

Creating And Writing Your Blog

The success of a blog lies in the content. It is the content and the key words that consistently attract potential customers. Great blog content literally means something different on every blog. Great blog content is researched and not impulsive. You cannot treat the blog as an experimental playground and expect it to work for you. It is designed to mean business and make you presence felt online and you have to ensure it performs the way you want it to.

Get My Free Ebook

Post a comment