Custom Search

Monday, May 12, 2008

Tutorial : Slide Show



Coldfusion Tutorial: Slide Show

Description
Just create a file slideshow.cfm and a image folder.You must enable the session in application page.



Example

slideshow.cfm page


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="refresh" content="5"/>
<title>Slide Show</title>
</head>

<body>

 <cfset templatePath=GetBaseTemplatePath()>
 <cfset rootFolder=ListDeleteAt(templatePath,ListLen(templatePath,"/\"),"/\")>
 <cfset imageFolderPath="#rootFolder#\images">
 
 <cfdirectory action="list" directory="#imageFolderPath#" name="ImageList">
 <cfif Not IsDefined("session.Counter") OR session.Counter GTE ImageList.RecordCount>
  <cfset session.Counter=0>
 </cfif>
 <cfset session.Counter=session.Counter+1>
 <cfoutput><img src="#imageFolderPath#\#ImageList.name[session.Counter]#"/></cfoutput>
 
</body>
</html>

   


Example Output