AspAlliance.com LogoASPAlliance: Articles, reviews, and samples for .NET Developers
URL:
http://aspalliance.com/articleViewer.aspx?aId=1775&pId=-1
Working with Presentations in ColdFusion
page
by Debjani Mallick
Feedback
Average Rating: 
Views (Total / Last 10 Days): 21374/ 32

Introduction

From the very start we know what computer is, we have heard about presentations. In our career, we must have created a lot of presentations using "Microsoft PowerPoint Presentation."  But now in ColdFusion 8, it is possible to build slide presentations programmatically using tags defined for creating presentations – cfpresentation, cfpresentationslide, and cfpresenter.

ColdFusion Slide Presentations

In ColdFusion 8, it is possible to create dynamic slide presentations. The slides can be designed using source files, or using HTML and CFML code on a ColdFusion page. When using code to populate a slide, we can populate slide content with the results of a database query, with charts or graphs, images, etc. It is also possible to add audio tracks and video clips to the slides of the presentation. The three tags provided in ColdFusion 8 make it all possible.

Tags in Detail

cfpresentation

This tag basically defines the look and feel of the presentation. It also determines whether to save presentation slides into files or to run it directly in the client's browser. It acts as a parent tag for cfpresentationslide tag and cfpresenter tag. This tag acts as a container for the presentation. The position, appearance, background color and text can be defined using this tag, but it should be kept in mind that the setting made in cfpresentation tag does not affect the settings in cfpresentationslide tag. The only required attribute for this tag is "title" which defines the title for the presentation. The other optional attributes present are:

Directory – If the presentation is to be saved in the disk, this is used to specify the directory where the presentation is to be saved. The path specified can be absolute or relative to the CFM page. If this attribute is not specified, then ColdFusion writes the files to a temp directory and then runs the presentation in the client browser.

Overwrite – This specifies whether to overwrite the files in the directory, specified by the directory attribute, if it is already present. This attribute applies when directory attribute is specified.

Loop – This decides whether to run the presentation in loop or not, i.e. to restart the presentation after it ends or not automatically.

InitialTab –This defines the tab which is to be displayed on the top when the presentation starts.

AuthUser – This sends a username to the URL which serves as the target for Basic Authentication.

AuthPassword – This sends a password to the URL which serves as the target for Basic Authentication.

ProxyHost – This specifies the host name of the proxy server where the request is sent.

ProxyPort – This specifies the port number to connect to the proxy server.

ProxyUser - This specifies the username required by the proxy server.

ProxyPassword - This specifies the password required by the proxy server.

UserAgent – It specifies the text to be put in the HTTP user-agent request header field.

AutoPlay – It determines whether to play the presentation or not. It takes a Boolean value of "yes" or "no."

Control – It specifies the presentation control to be normal or brief.

ControlLocation – This defines the location of the presentation control to be at right or left.

ShowNotes, ShowOutline, ShowSearch – All these attributes accept a Boolean value which determines whether to have the Notes tab, outline and Search tab in the presentation or not.

BackgroundColor – It defines the background color for the presentation.

PrimaryColor – This defines the presentation's primary color.

GlowColor – This defines the color of the glow effects on the buttons.

LightColor – This defines the light colors for light and shadow effects.

ShadowColor – This defines the shadow colors for light and shadow effects.

TextColor – This defies the color for all the text in the presentation.

All the color attributes can accept only some of the colors defined, not all.

cfpresentationslide

This tag is used to create a slide dynamically using source files or HTML or CFML code. If source file is not specified, then HTML or CFML code needs to be defined for the body of the slide. If both source file and code is defined for a slide, Coldfusion ignores the source, and displays the HTML\CFML content as the body of the slide. The attributes for this tag are:

Src – This defines the HTML or SWF source file for the slide. And the file should be present on the system running ColdFusion.

Title – This defines the title of the slide.

Advance – This can be used to override the AutoPlay attribute specified in the cfpresentation tag. This can take three possible values – auto (the next slide automatically played after a slide plays), never (the control does not move automatically to the next slide) and click (the user needs to click in the active presentation area to migrate to the next slide).

Duration – This decides the time for which each slide gets displayed before the control moves to the next slide automatically. If this is not specified, the slide plays for the time the audio clip associated with the slide plays.

Audio – This defines the path to the audio file which should be of MP3 format to be associated with a slide.

Video – This defines the path for the video clip which should be a FLV or SWF file to be associated with the slide. Both audio and video cannot be specified for a single slide.

Presenter – This adds a presenter to a slide. A slide can have only one presenter and the presenter should be defined using the cfpresenter tag.

Scale – This defines the scale used for the HTML content displayed in a slide.

Notes – This defines the notes used for the slide which is displayed only when ShowNotes attribute is "yes" in cfpresentation tag.

AuthUser, AuthPassword, UserAgent – These are used of the same purpose here as in cfpresentation tag.

MarginTop, MarginBottom, MarginLeft, MarginRight – These are used to specify the top, bottom, left and right margin for the slide.

cfpresenter

This is used to define the presenter’s name and details. The presenter information is displayed in the control panel for the slide with which it is associated. The only required attribute for this tag is name which defines the name of the presenter. The other optional attributes of this tag are:

Title, Email – These are used to define the title and email address of the presenter.

Logo, Image – These specify the path to JPEG files defining the presenter's logo and image respectively.

Biography – This string describes information about the presenter.

Creating a presentation

Below is an example of creating a presentation using the tags defined in ColdFusion 8.

Listing 1

<cfpresentation title="Example Presentation" directory="presentationDemo" 
overwrite="Yes" showNotes="Yes">
<cfpresenter name="Presenter1" title="Title for first presenter" 
email="presenter1@demoExample.com" image="Image1.JPG">
<cfpresenter name="Presenter2" title="Title for second presenter" 
email="presenter2@demoExample.com" image="Image2.JPG">
<cfpresenter name="Presenter3" title="Title for third presenter" 
email="presenter3@demoExample.com" image="Image3.JPG">
<!--- The code below is used to create a slide from HTML code. --->
<cfpresentationslide notes="Notes for slide1">
<h3>Slide1</h3>
<ul>
<li>ExampleList1</li>
<li>ExampleList2</li>
<li>ExampleList3</li>
</ul>
</cfpresentationslide>
<!--- The code below is used to create a slide from HTML and CFML code. --->
<cfpresentationslide Title="Slide2" duration="10" presenter="Presenter1" 
notes="Notes for slide2">
<h3>Slide2</h3>
<cfchart format="png" showborder="yes" chartheight="200" chartwidth="250">
<cfchartseries type="cylinder">
<cfchartdata item="Item1" value="5">
<cfchartdata item="Item2" value="10">
</cfchartseries>
</cfchart>
</cfpresentationslide>
</cfpresentation>

Here the directory attribute specified in the cfpresentation tag, presentationDemo, is relative to the CFM page. We have defined three presenters for the slide presentation in the cfpresenter tag, along with the email ID and image for the presenters. In the first slide we have not defined any presenter. But in the second slide we have.

In a presentation created using ColdFusion, the slides appear or play in the order they are listed on the ColdFusion page. Each slide gets played for the duration specified and the information of the presenter, if added to a slide, gets displayed in the control panel next to the particular slide to which the presenter is assigned. The color settings do not affect the format of the slides, they affect the presentation interface. In practical, ColdFusion creates some files automatically required to run the presentation. Those are:

conponents.swf

index.htm

loadflash.js

viewer.swf

Those files get saved in the specified directory. ColdFusion also creates a subdirectory called data where it stores srchdata.xml, vconfig.xml, viewer.xml, a SWF file generated for each slide of the presentation and copies of media files referenced in the presentation slides which can include JPEG files, FLV and SWF video files. srchdata.xml creates the search interface. Clicking on index.htm file present in the directory makes the presentation to run.

Conclusion

I hope this article will help the ColdFusion developers create rich presentations using ColdFusion 8 with ease.

By Debjani Mallick


Product Spotlight
Product Spotlight 

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-24 3:34:13 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search