Type: Plugin
A simple plugin to output flash files in Expression Engine templates using JavaScript SWFObject. This allows for automatic checking of flash player versions on users machines, and an express install option for speedily upgrading users to the latest flash player.
Requirements
- Tested only on Expression Engine 1.6.4 or higher (may work with lower versions...)
- SWFObject is required as a JavaScript include on pages which use TK SWF Object Embed
Parameters
- id - [string] - The ID of the container div which holds the SWF content (if you have more than one SWF file on a page, you must give an ID).
- width - [int] - The width of the flash file in pixels.
- height - [int] - The height of the flash file in pixels.
- version - [int] - The flash version of the embedded file. If this version of flash is not found installed on the users machine, then the express install for flash will be prompted.
- class - [string] - A class for the container div.
- params - [string] - A comma separated list of flash embed parameters.
- flashvars - [string] - A comma separated list of flash variables.
- express - [string] - The location of SWFObjects expressInstall.swf file.
- Tag content - [string] - Anything placed inside the tkswfobjectembed tag will be displayed to users who do not have flash (or javascript) installed.
Installation
Copy the pi.tkswfobjectembed.php file in to your systems plugins folder, normally located at /system/plugins.
To use TK SWF Object Embed, you must first install the SWFObject JavaScript code on your site.
- SWFObject v2.1 is included with this plugin in its zip archive. Copy and paste the content of swfobject.js and place the code in to your own Expression Engine template. For example, you may choose to name your file swfobject.js and place it in a template group called _incs.
- You'll then need to embed that code with a <script> tag within your pages HTML code. If you placed your SWFObject file in a template group as given in the previous example, your HTML code should look like this: <script src="/_incs/swfobject.js" type="text/javascript"></script>. This should go in your HTML page's <head> tag.
SWFObject uses an 'express install' method to help users without flash, get it faster. You must copy the expressInstall.swf file to a location on your server. When you run the plugin, you can use the express parameter to tell SWFObject where the file lives.
Example
With your SWFObject JavaScript embedded in to your HTML page and your expressInstall.swf copied to your server; you can now use TK SWF Object Embed in your templates. For example, you may wish to correctly embed a YouTube video in to your page:
{exp:tkswfobjectembed file="http://www.youtube.com/v/JB_deAcoC2I" version="8" width="425" height="344" flashvars="hl=en,fs=1" params="allowFullScreen=true,wmode=false" express="/images/expressInstall.swf"}
<p>Oops! You don't appear to have flash installed.</p>
{/exp:tkswfobjectembed}
This will output the following HTML:
<div id="myflashvideo">
<p>Oops! You don't appear to have flash installed.</p>
</div>
<script type="text/javascript">
<!--
var flashvars = {
hl:"en",
fs:"1"
};
var params = {
allowFullScreen:"true",
wmode:"false"
};
var attributes = {
id: "myflashvideo",
name: "myflashvideo"
};
swfobject.embedSWF("http://www.youtube.com/v/JB_deAcoC2I", "myflashvideo", "425", "344", "9", "/images/expressInstall.swf", flashvars, params, attributes);
-->
</script>
Which will in turn, be rendered like this:
Oops! You don't appear to have flash installed.
If you'd like to send me beer money in exchange for updates and more modules, please do!
It'll be a Leffe or Hoegarrden by the way ;)
Version 0.3
27th October 2008
- Changed default expressInstall.swf location to /images/
- Updated the plugins usage notes.
Version 0.2
21st October 2008
- First public release
Comments
Can you add a proper opening PHP tag to this plugin? Your use of a shorttag (<? instead of <?php) causes parse errors on servers where PHP is compiled with short_tags = Off.
Matthew Pennell
I watch this video.If you’d like to send me beer money in exchange for updates and more modules, please do!
Nissan Frontier Superchager