After Ryan went through a fair amount of effort to help get me on MXNA, I thought it was only fair that I get some ColdFusion posting in. (Especially after last night’s drunken geekery.)
A while back I posted about creating a CFC that would embed dynamically created Flashpaper created by <cfdocument>. However, it didn’t create Webstandards compliant XHTML code. So, I updated it to do so using a variation on the Satay Method.
Now I know I’m outputting from a CFC, but frankly, I really don’t like custom tags, so I do this sort of thing in CFC format.
Check out the updated code: Flashpaper Embedder.
11 thoughts on “Updated Flashpaper Embedder”
Thanks, I found this useful, also thanks for flagging up Satay. I don’t mean to nit-pick but the CFC throws an error as it’s missing a double quote here:
<cfif overwrite or not fileExists(#This.cachedirectory#/#arguments.filename#”)>
If you set the overwrite arg to false it will also throw an error.
Using a cache directory for files is okay if your site doesn’t have many Flashpaper files but what if it does? A load of files can quickly build up especially if each file is unique to every user. It would be nice if there was a way to embed Flashpaper but serve it from memory. Not sure how?
Thanks, it’s not nitpicking, they are legitimate issues.
The error with overwrite=”FALSE” has been fixed. The code I use to display code with coloring caused the missing quote.
As for the temp display of it, I’m intrigued. That does sound like a better way of doing it. I too am not sure how to, but I’m going to think on it.
Here’s a link to my new tag. I’ve called it CF_EmbedDocument. http://www.hotfusion.co.uk/embedDocument/index.htm (or click on my name).
I can’t use a CFC because the tag is called once as a regular cfm page (which CFCs can’t) and again as a custom tag.
Unfortunately my website runs PHP, not CF so there’s no live demo. You can house it here if you think it’s worthy enough. Ideas for improvements welcomed.
Gary: It’s really cool code. However I can’t seem to make it webstandards compliant and work in IE at the same time. So it’s an alternative solution to the issue, depending on your needs.
That being said, it’s very cool.
Thanks for the feedback. What bit isn’t “webstandards compliant”? The iframe element?
Actually it was the script tags themselves. Pretty much all tags have to be lowercase. Additionally, it requires a type for script. I have what I had done at home, I can email it to you later.
Oops, lower case, of course! I’m so used to doing upper case for tags and lower for attributes – it makes it easier to read. Thanks.
I want to buy more memory for my notebook.