Kimili, WordPress, Relative Paths And The Base Attribute

Embedding complex SWF content in WordPress which loads or references other content can be bit tricky. Often the embedded SWF is hosted in different directory than the WordPress page that contains the embed code which means simple relative paths often fail. The reason for this is that SWF files, by default, assume the page in which they are hosted is the “base” location and use that uri to construct all relative paths. This means that relative paths are often out of scope and unresolvable (I ran into this recently with a Flex example that included the “view source” option). The solution is to manually tell the embedded SWF what the desired base path is by setting the “base” attribute in the object / embed tags.

2008-05-26_0208.png

The Flash Player object / embed tags support manually setting the “base” attribute to a different location as described here. However, as I’ve mentioned before I use the killer Kimili plugin for embedding Flash content in WordPress (necessary because WordPress likes to strip out tags it doesn’t understand). Kimili, developed and maintained by Michael Bester, supports all of the object / embed attributes and uses SWFObject under the hood making it a breeze to embed Flash via its special syntax.

Here’s what a working example of setting the base definition in Kimili looks like.

example_base_url.png

Simple. Hope it saves someone some heartache.

10 thoughts on “Kimili, WordPress, Relative Paths And The Base Attribute

  1. Hi there
    i have installed the plugin 1.4 and it works with swf files, but i cant get it work with the base… The flash shows up in the wordpress page but theres nothing happening.

    The xml is in the vids folder, if i go there directly it works fine, except in wordpress 2.5 pls help

  2. Hi there

    Im still getting the same error, i deactivated all the plugins and still the same issue

    Pls help

  3. Hi there

    Just thought id let you know that its fixed now. i changed the swf, and removed the vids folder. All video’s are in the same folder, but you still need the BASE in order for it to get the xml… If theres guys that didnt know that…

  4. Just wanted to say thank you for sharing this info and how to do it. I was working on a wordpress project involving flash and racked my brain trying to figure out why I couldn’t get the player to pull in the info from my xml file but thanks to this post I got it to work. Thanks, again!

  5. Just started with Kimili today. Lots of relative paths in the SWF itself. This thread is great, thanks.

    -ML

  6. This is good to know for flash embedding with a page / post. Come to find out you can use the swfObject param tag “base” equally in a template or header / footer file. Thanks for posting this information, relative paths and permalinks have caused problems before and I’d suspect for many others.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>