CFPRESENTATION is one of those tags that are pretty good - but I'm not sure how often I'll use it. While working on WACK though I discovered that the tag has a feature that is pretty darn interesting. As you may (or may not know), the CFPRESENTATION tag creates Connect presentations on the fly. This could be useful for multiple purposes. You could use it to create dynamic portfolios for a company. You could use it for tutorials. Etc. This example creates a basic 2 slide static example:
1 <cfpresentation title="First Presentation"
2 autoPlay="false">
3
4 <cfpresentationslide title="Welcome to CFPRESENTATION"
5 notes="These are some notes.">
6 <h1>Welcome to CFPRESENTATION</h1>
7
8 <p>
9 This is content for the first slide. I can include HTML
10 and it will be rendered by the presentation.
11 </p>
12 </cfpresentationslide>
13
14 <cfpresentationslide title="Sales Figures"
15 notes="These are some notes for slide two.">
16 <h1>Sales Figures</h1>
17
18 <p>
19 Some fake data.
20 </p>
21
22 <p>
23 <table width="100%" border="1">
24 <tr>
25 <th>Product</th>
26 <th>Price</th>
27 </tr>
28 <tr>
29 <td>Apples</td><td>$0.99</td>
30 </tr>
31 <tr>
32 <td>Bananas</td><td>$1.99</td>
33 </tr>
34 <tr>
35 <td>Nukes</td><td>$2.99</td>
36 </tr>
37 </table>
38 </p>
39 </cfpresentationslide>
40 </cfpresentation>
You can see this output here.
What I discovered (and the reason for the post is), you can also use CFPRESENTATION to create offline presentations as well. If you supply the directory attribute, the generated Connect presentation will be stored to the file system. This code will have no need for ColdFusion and could be zipped up (using CFZIP) and mailed to someone. The end user could then unzip the files onto their desktop and open the presentation there. Here is a short snippet showing this in action:
2 autoPlay="false">
3
4 <cfpresentationslide title="Welcome to CFPRESENTATION"
5 notes="These are some notes.">
6 <h1>Welcome to CFPRESENTATION</h1>
7
8 <p>
9 This is content for the first slide. I can include HTML
10 and it will be rendered by the presentation.
11 </p>
12 </cfpresentationslide>
13
14 <cfpresentationslide title="Sales Figures"
15 notes="These are some notes for slide two.">
16 <h1>Sales Figures</h1>
17
18 <p>
19 Some fake data.
20 </p>
21
22 <p>
23 <table width="100%" border="1">
24 <tr>
25 <th>Product</th>
26 <th>Price</th>
27 </tr>
28 <tr>
29 <td>Apples</td><td>$0.99</td>
30 </tr>
31 <tr>
32 <td>Bananas</td><td>$1.99</td>
33 </tr>
34 <tr>
35 <td>Nukes</td><td>$2.99</td>
36 </tr>
37 </table>
38 </p>
39 </cfpresentationslide>
40 </cfpresentation>
1 <cfset directory = expandPath("./stored")>
2 <cfif not directoryExists(directory)>
3 <cfdirectory action="create" directory="#directory#">
4 </cfif>
5
6 <cfpresentation title="First Presentation"
7 autoPlay="false" directory="./stored">
8 More slides here...
I've included a simple presentation at the end of this blog post. Just use the download link. For more about CFPRESENTATION, be sure to pick up the WACK!
2 <cfif not directoryExists(directory)>
3 <cfdirectory action="create" directory="#directory#">
4 </cfif>
5
6 <cfpresentation title="First Presentation"
7 autoPlay="false" directory="./stored">
8 More slides here...
Comment 1 written by Brian Swartzfager on 29 August 2007, at 6:33 AM
Comment 2 written by Jim Priest on 29 August 2007, at 7:37 AM
Comment 3 written by Raymond Camden on 29 August 2007, at 8:20 AM
Answer to q2: You could dynamically generate the preso, but then it is static.
Comment 4 written by someone on 29 August 2007, at 8:50 AM
seen Adobe Connect Presenter? the little tool that takes a powerpoint, adds the presenters details and audio track and converts it to a swf as content for your breeze presso?
where have you seen one of them I wonder?
the only thing I've yet to try is saving the PPT to HTML first and then SWF'ing it with the cfpresentation tag.
Comment 5 written by David on 29 August 2007, at 9:21 AM
Cheers,
Davo
Comment 6 written by Raymond Camden on 29 August 2007, at 9:25 AM
Comment 7 written by William from Lagos on 29 August 2007, at 9:46 AM
Comment 8 written by Yves on 29 August 2007, at 10:19 AM
Is it possible to print from the presentation. ?
Comment 9 written by Raymond Camden on 29 August 2007, at 10:24 AM
Comment 10 written by Gene Godsey on 26 November 2007, at 10:29 AM
Comment 11 written by Jeff on 14 February 2008, at 8:21 AM
Comment 12 written by barry.b on 14 February 2008, at 8:33 AM
while cfpresentation can use HTML to create content, the final result is a SWF. it's basically CFContent who's output is Flash.
having said that, using a swf as content gives you most of the functionality of Flash. we use it for having a m/c quiz at the end of a presso, so at a guess, a form and posting values to a url might be possible. the target url might have to be hard-coded however...
I can see where you're going with the idea, and it would be great if it could, but I'm not sure it's possible or practical.
Comment 13 written by barry.b on 14 February 2008, at 8:35 AM
oops, I mean cfdocument who's output is flash/flashpaper
Comment 14 written by Jeff on 14 February 2008, at 8:42 AM
Thanks
Comment 15 written by Sean on 20 February 2008, at 8:57 PM
Comment 16 written by Raymond Camden on 21 February 2008, at 6:15 AM
Comment 17 written by John Barrett on 3 February 2009, at 12:26 AM
I just asked this question on CF Talk, and searching Google let me find this post, thank so much!
One question however, is it possible to replace the current files in the stored directory that you write to? That if you should modify the file?
I am just using
<cfpresentation title="my title" directory="./stored">
Thanks so much,
John
Comment 18 written by John Barrett on 3 February 2009, at 1:27 AM
Well I got it`-`
<cfpresentation title="my Title" autoPlay="false" directory="./stored" overwrite="yes">
I just wanted to post this here incase somebody else finds this and was wondering the same thing.
Thanks so much:)
John
Comment 19 written by Raymond Camden on 3 February 2009, at 6:08 AM
Comment 20 written by John Barrett on 4 February 2009, at 12:56 AM
Without the overwrite=yes, CF threw an error "unable to create file" So I ask asking how to replace the current files this way, but with CF, and not manually replace the files.
By the way, this was for a class presentation, and it was a big hit, the instructor really loved the output, and when I showed him how it was made, even more impressive, CF Rocks:)
Maybe this will motivate the University to get a coldFusion Server.
Comment 21 written by Raymond Camden on 4 February 2009, at 6:05 AM
Comment 22 written by Mike on 8 April 2009, at 9:23 PM
example: audio="rtmp://x.x.x.x/Music/Track-01.mp3"
Comment 23 written by Raymond Camden on 8 April 2009, at 9:34 PM
Comment 24 written by Gerd on 23 July 2009, at 3:17 PM
I was wondering if you could help on this one. I keep getting the following error message when I try to run a cfpresnetation.
java.io.FileNotFoundException: C:\ColdFusion8\lib\preso\blank.swf (The system cannot find the file specified)
I get this message even if I specifiy a directory. All the files do get created in the directory I specify,
yet i still get this same error message. I've also used your exact code from this post and I get the same thing.
I've googled on this and can't find anything. Thought you might be able to help.
Thanks
Comment 25 written by Raymond Camden on 24 July 2009, at 3:34 PM
Comment 26 written by Raymond Camden on 24 July 2009, at 3:35 PM
Comment 27 written by Don on 7 September 2009, at 9:01 AM
Comment 28 written by Raymond Camden on 7 September 2009, at 9:04 AM
Comment 29 written by Don on 7 September 2009, at 9:18 AM
Code: <cfpresentationslide src="#assets#intro.swf" />
assets obviously evaluates to: /images/tutorial/
If I put an absolute file path it works.
Comment 30 written by Don on 7 September 2009, at 9:28 AM
Comment 31 written by Raymond Camden on 7 September 2009, at 9:33 AM
Comment 32 written by Don on 7 September 2009, at 9:44 AM
Comment 33 written by Raymond Camden on 7 September 2009, at 9:45 AM
Comment 34 written by Don on 7 September 2009, at 10:23 AM
Comment 35 written by Joe on 6 November 2009, at 5:19 PM
Comment 36 written by Corey on 7 January 2010, at 7:49 PM
Has anyone else experienced this?
[Add Comment] [Subscribe to Comments]