Kimili Flash Embed for Textpattern - v. 0.4
Update! 1.24.06
This article is officially outdated. There’s a brand new version of KFE out with many new features. You can find it at the new permanant home of KFE.
Here we go once again.
The Kimili Flash Embed for Textpattern has been updated, this time expanding the functionality to give you access to all sorts of Textpattern variables so you can pass them into your movie. Does your flash movie need to know the current section? No problem. How about the ID of the current article? Or the site name, slogan or language? Not a problem either. These variables and many more are all easily accessible with this new version of the plug in, so have at it.
kml_flashembed_tp_04.zip
Get the latest version, always available at the KFE Home.
The Basics
If you’ve downloaded a previous version of the Kimili Flash Embed, the contents of the Zip file should look familiar to you. In it you’ll find the following files:
- flashobject.js – This is Geoff Stearn’s Javascript
- kml_flashembed.txt – This is the plugin file
- readme.txt – Go figure
If you’re updating a previous install, all you have to do is reinstall the plugin itself in your Textpattern administration section. The JavaScript is the same, so there is no need to overwrite that.
If this is a new install for you, in addition to installing the plugin, you’ll also have to make the javascript file accessible by your page templates. You can do this by putting flashobject.js in a folder called js off of the root of the site. Then add the following line of code in the head of your page templates:
<script language="JavaScript"
type="text/javascript"
src="/js/flashobject.js">
You can add Flash content to your pages using a tag like this in your articles or anywhere else in the textpattern environment (Article Forms are extra-special – more about this below):
<txp:kml_flashembed movie="filename.swf" height="150" width="300" />
What’s New?
This version of the plugin gives you access to the pretext, prefs and thisarticle Textpattern global arrays. Contained within these three arrays are most of the variables relevant to both your articles and your Textpattern install.
Since these three arrays are split open by the plugin, you have direct access to all the goodness contained within each one. According to Risedesign, these resulting variables for each array include:
pretext
- $id – The current article’s ID
- $s – The current section
- $page – The current page template name
- $css – The name of the CSS file being used
- $c – The current category, if any
- $q – The current search query, if any
- $count – Not sure about this one
- $pg – The current page, if any
- $p – Not sure about this one
- $next_id – The next article’s ID, if any
- $next_title – The next article’s title, if any
- $next_utitle – The next article’s URL-only title, if any
- $prev_id – The previous article’s ID, if any
- $prev_title – The previous article’s title, if any
- $prev_utitle – The previous article’s URL-only title, if any
- $path_from_root – The path from the root in config.php
- $pfr – Not sure about this one
- $url_mode – “1” for clean, “0” for messy
- $sitename – Outputs the Site Name, as defined in the admin tab
prefs
These settings come from your Site Preferences under the admin tab, as well as the config.php file.
- $prefs_id – Not sure about this one
- $sitename – The site name
- $path_from_root – The Textpattern installation subdirectory.
- $siteurl – Kind of obvious, huh?
- $site_slogan – This one too.
- $language – The language you’ve set in preferences.
- $timeoffset – The time offset of the server
- $dateformat – The date format for articles
- $archive_dateformat – the date format for archived articles
- $url_mode – “1” for clean, “0” for messy
- $send_lastmod – Send last modified header – “1” for true, “0” for false
- $ping_weblogsdotcom – Ping weblogs.com – “1” for true, “0” for false
- $logging – Returns “all” if set to “All hits”, “referer” if set to “Referers only” or “none” for “None”.
- $record_mentions – “1” for true, “0” for false
- $use_textile – “2” for “use textile”, “1” for “convert linebreaks”, “0” for “Leave Untouched”
- $use_categories – “1” for true, “0” for false
- $use_sections – “1” for true, “0” for false
- $use_comments – “1” for true, “0” for false
- $comments_moderate – Moderate comments, “1” for true, “0” for false
- $comments_on_default – Comments on by default?, “1” for true, “0” for false
- $comments_default_invite – Default comment invitation
- $comments_dateformat – The date format for comments
- $comments_mode – “1” for “popup”, “0” for “no popup”
- $comments_sendmail – Mail comments to author, “1” for true, “0” for false
- $comments_disallow_images – Disallow user images, “1” for true, “0” for false
- $comments_disabled_after – “0” for never, “7” for one week, “14” for two weeks, etc.
- $rss_how_many – Set in config.php, how many articles should be used in the RSS feeds as standard.
- $lastmod – Contains a formated timestamp when the site, all-in-all, was last modified.
- $logs_expire – Set in config.php, how many days a log entry should be stored in the database.
- $img_dir – Set in config.php, The directory where you upload images.
- $version – The version of Textpattern you are using.
thisarticle
These variables are special, because they are only available when you use the <txp:kml_flashembed /> tag within an article form. If you’re not sure what I mean by that, go to the presentation / forms tab in your admin and open up any form with a type set to article. (default, for example) If you put a flash embed tag in there, then that instance of the tag will have access to the following variables:
- $thisid – The ID of the article being rendered
- $author – The author of the article being rendered
- $posted – The article date
- $if_comments – “true” or “false” depending whether or not the article has comments
- $comments_invite – The formatted
<a>tag for the comment invitation - $comments_count – The number of comments the article has
- $permlink – The formatted
atag used to view the article - $title – The article title
- $excerpt – The article excerpt
- $body – The textiled body HTML
- $url_title – The title of the URL of the article, if specified
- $category1 – The primary article category
- $category2 – The secondary article category
- $section – The section the article is filed under
- $keywords – The “Keywords” field, as is
- $article_image – The “Article Image” field, as is
So What Do I Do With All This?
All of the above variables are accessible via the fvars attribute of the <txp:kml_flashembed /> tag. Let’s say you wanted to pass your movie the current section in a variable named section. The fvars attribute would look like this:
fvars=" section = $s "
If you wanted to pass the section and the ID of the current article to the movie, you could do so like this:
fvars=" section = $s ; id = $id"
Of course, you could still mix these with static variables, like this:
fvars=" section = $s ; id = $id ; links = /files/links.xml "
Just remember, in all the examples above, the variable names within the fvars attribute match up with variable names within your flash movie.
One Other Thing
In previous versions of the plugin, you could assign an ID to your flash movie using the attribute named id. Since there is now access to a variable named $id which refers to the article ID number, a naming conflict arose. In order to solve it, I had to rename the attribute that tags the flash movie with a unique ID. So starting with version 0.4, you will need to use the attribute fid to assign an id to the flash movie.
Also, if you choose not to assign an ID, one will be generated automatically for you based on the .swf filename. For example, if your .swf file is named mymovie.swf, the auto-generated ID will be fm_mymovie.
All of the other attributes remain the same. You can find a list of all of them in the readme.txt file of in the original post.
That’s about all there is to this update. Enjoy, and let me know if you find any issues with it.
Comments
Jamie says:
1202 days ago
Sweet. Nice one…thanks for contributing!
Jonathan Wan says:
1044 days ago
Nice job~! this is so cool for integrate Flash with TXP. Thanks alot for hard-work~!
alex says:
1034 days ago
Does the plugin work for TXP v. 4.0+? If not, do you intend to update it?
Michael Bester says:
1032 days ago
It seems that some of the functionality is broken, at least in TXP 4.0.1. I will update the plugin to get it working again, perhaps a new feature or 2…
Arthur Case says:
1014 days ago
Hi Michael,
Thanks for this plugin – it’s really great work.
Any idea as to when you’ll have the update ready?
Thanks.
Michael Bester says:
1014 days ago
I do have the update almost ready, but I just haven’t had the time to wrap it up. I do intend to release it sooner rather than later though…
Arthur Case says:
1014 days ago
Fantastic. Thank you!
Ann says:
997 days ago
I think I did something wrong…
I created the js folder and uploaded with the script
I uploaded kml_flashembed.txt to the plug-in folder
Added the script tag to the head tags of the template
I log in to Wordpress Admin and go to plug-in there is no plug in to activate.
When I type the flash tag… the text with in the tag shows on the blog.
What am I doing wrong?
http://www.ebusinesshelpsite.com/internetbusiness
Thanks
Ann
Michael Bester says:
996 days ago
Ann – It looks like you need the “WordPress” version of the plugin. The version available on this page is for Textpattern, which your site isn’t using.
* Get the latest version of Kimili Flash Embed for WordPress
* Usage Instructions for said plugin
Carina Fuller says:
955 days ago
It sounds like a great plug-in and I wish I could make it work:
I put flashobject.js in a folder called js in the root of the site.
Then added in the head of my page template.
I installed and activated the plugin and placed in my page template where the flash movie should appear.
I also uploaded the .swf file to the root of my site (outside the textpattern folder) and the .xml files as well that provide the image info. The movie works well, just not in TXP?
Any suggestions greatly appreciated!
Thank you!Dada
Carina Fuller says:
955 days ago
It sounds like a great plug-in and I wish I could make it work:
I put flashobject.js in a folder called js in the root of the site.
Then added the script in the head of my page template.
I installed and activated the plugin and placed the flash tag as described in the help file in my page template where the flash movie should appear.
I also uploaded the .swf file to the root of my site (outside the textpattern folder) and the .xml files that are needed. The movie works well, just not with TXP?
Any suggestions greatly appreciated!
Thank you!Dada
Michael Bester says:
954 days ago
Carina – You did get the plugin to work! You’re using Slideshow Pro, and like any Flash movie that is expecting external data – often in the form of XML files, you have to tell it where to find that data, and you haven’t done that yet.
In the case of SSP, it’s expecting you to give it a url to the XML file. Using the kml_flashembed, you would do this using the fvars attribute, something like this:
< kml_flashembed movie=”moviename.swf”
height=”100”
width=”100”
fvars=” xmlloc = /path/to/file.xml ” />
Now I am not sure if xmlloc is the correct variable name that SSP is looking for. You’ll have to check its documentation for that.
Also, the path to the file that you give to SSP should be absolute, back to the root of the site. This way you’ll be sure that the flash finds the file.
Hope this helps!
Terry Evans says:
934 days ago
This plugin is amazing. It’s pretty much exactly what I’m looking for except that it does not take advantage of Geoff’s revised method for embedding Flash movies.
Any chance you’d consider updating your plugin to support this method?
Michael Bester says:
933 days ago
Terry – I am wrapping up new versions of this plugin for both Textpattern and Wordpress which use Geoff’s latest version of the flashobject code. They’ll take advantage of the flashobject’s revised methods and add some new functionality to give them even more flexibility.
Look for them in the next few weeks…
Terry Evans says:
933 days ago
Looking forward to it Michael!
roberto.deoc says:
919 days ago
First: Amazing work! Thanks a lot…
When I try to use the bgcolor attribute with Textpattern version: 4.0.3 (r1188) the Simple Viewer slideshow that I am trying to create disappear… I can use the same bgcolor with wordpress, and it works fine.
Here is my Txp article:
txp:kml_flashembed movie=”../viewer.swf” fvars=”xmlDataPath=../imageData.xml” bgcolor=”#ffffff” height=”800” width=”800” /
(< > omitted)
Any idea where I am making a mistake?
Thanks,
Roberto.deoc
Michael Bester says:
916 days ago
Roberto – Do you have a test page?
I don’t have much to go by, but just looking at your code I would suggest that you change the paths to your movie and the xmlDataPath to be absolute rather than relative. Give it a try and let us know!
Roberto.deOC says:
915 days ago
Michael,
This is the code generated by the TXP plugin:
script type=”text/javascript”>
//
omitted again)
The are two sets of quotes generated around the bgcolor tag. If I do not use the bgcolor tag, the SimpleViewer slideshow works fine (with the default blue background).
Absolute or relative paths in this case made no difference at this level. Where it is very important to use ABSOLUTE paths and not relative is in the xml file to point to the images and thumbnails folders.
This is the same code generated with the WP plugin:
script type=”text/javascript”>
var flashObject = new FlashObject(”../viewer.swf”, “fm_viewer”, 800, 500, 6, ”#ffffff”);
flashObject.addVariable(“xmlDataPath”, ”../imageData.xml”);
flashObject.write();
Roberto.deOC says:
914 days ago
Michael, the code did not upload in full and the end of the message neither… The problem is the double quotes at the bgcolor tag…
Thank you for your help,
Roberto.
Michael Bester says:
913 days ago
Roberto – that’s a bug in the old version of the plugin. You should go over to the new permanant home of KFE and download version 1.0
Comments are closed for this entry. Please go home.
kamilla says:
1226 days ago
I’m so happy! Thank you very very mutch