Cool feature in CFPRESENTATION

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">

&lt;cfpresentationslide title="Welcome to CFPRESENTATION" 
					 notes="These are some notes."&gt; &lt;h1&gt;Welcome to CFPRESENTATION&lt;/h1&gt;

<p> This is content for the first slide. I can include HTML and it will be rendered by the presentation. </p> </cfpresentationslide>

&lt;cfpresentationslide title="Sales Figures" 
		 notes="These are some notes for slide two."&gt; &lt;h1&gt;Sales Figures&lt;/h1&gt;

<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> </code>

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… </code>

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!<p>Download attached file.</p>

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments