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:
<cfpresentation title="First Presentation" autoPlay="false">
<cfpresentationslide title="Welcome to CFPRESENTATION" notes="These are some notes.">
<h1>Welcome to CFPRESENTATION</h1>
<p> This is content for the first slide. I can include HTML and it will be rendered by the presentation. </p> </cfpresentationslide>
<cfpresentationslide title="Sales Figures" notes="These are some notes for slide two.">
<p> Some fake data. </p>
<p> <table width="100%" border="1"> <tr> <th>Product</th> <th>Price</th> </tr> <tr> <td>Apples</td><td>$0.99</td> </tr> <tr> <td>Bananas</td><td>$1.99</td> </tr> <tr> <td>Nukes</td><td>$2.99</td> </tr> </table> </p> </cfpresentationslide> </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:
<cfset directory = expandPath("./stored")> <cfif not directoryExists(directory)> <cfdirectory action="create" directory="#directory#"> </cfif>
<cfpresentation title="First Presentation" autoPlay="false" directory="./stored"> 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!