%
' ASP Emporium: Free ASP Source Code by Bill Gearhart
' http://www.aspEmporium.com/
' Downloaded On: 11/30/00
' Original File Name: default.asp
' Original File Location: http://www.aspEmporium.com/aspEmporium/examples/default.asp
' This code is provided as is with no support and no guarantees.
' You can view the license for this source code at the following address:
' http://www.aspEmporium.com/aspEmporium/help/license.asp
' Most files require a global.asa and the myData.mdb MS Access
' developmental database, both of which can be downloaded from the ASP Emporium.
' Enjoy,
' Bill Gearhart
%>
<%
Option Explicit
Response.Buffer=True
' *********************** simple slide show presentation system ************************
' DateCreated: 1/3/2000
' DateLastModified: 8/17/2000
' NOTES:
' This application does not require any of the include files
' that are colored green below. These include files are used
' to create the ASP Emporium website layout. To use this code
' as is, delete all includes below.
' This application requires the myData.mdb database and uses
' the default table.
' the table named default consists of the following fields:
' pageNumber - the page number of the entry. The initial page should be 1
' slideType - the type of item to be displayed: text, image or html
' displayItem -
' text : the text to be displayed is written directly here
' image : the path of the image you wish to display
' html : the path to a page that you wish to insert into the slide show
function GetSlideShowFile(byVal path)
Dim FSO : Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Dim File : Set File = FSO.OpenTextFile( server.Mappath( path ) )
Dim t : t = File.ReadAll : File.Close : Set File = Nothing : Set FSO = Nothing
GetSlideShowFile = t
End Function
Function GetPagesInPresentation()
Dim c : set c = server.createobject("adodb.connection")
Dim r : set r = server.createobject("adodb.recordset")
c.Open Application("dbConn"), Application("dbUsr"), Application("dbPass")
r.Open "SELECT * FROM Fiedler", c, 3, 1, &H0001
GetPagesInPresentation = r.recordcount
r.close : set r = nothing : c.close : set c = nothing
End Function
function GetDisplayItem()
Dim c : set c = server.createobject("adodb.connection")
Dim r : set r = server.createobject("adodb.recordset")
c.Open Application("dbConn"), Application("dbUsr"), Application("dbPass")
Dim sp_Slide
sp_Slide = "SELECT Fiedler.* FROM Fiedler WHERE ((([Fiedler].[pageNumber])="
sp_Slide = sp_Slide & CLng(session("myPage"))
sp_Slide = sp_Slide + "));"
r.open sp_Slide, c
select case lcase( r("slideType") )
case "text"
' a text item is taken directly from the database
' so show it with no html formatting.
GetDisplayItem = "" & server.htmlencode( r("displayItem") ) & ""
case "image"
' create an image tag because we are showing a picture.
GetDisplayItem = ""
case else
' we are displaying a file so get it and display it below.
GetDisplayItem = GetSlideShowFile(r("displayItem"))
end select
r.close : c.close : set r = nothing : set c = nothing
end function
Dim displayMethod : displayMethod = lcase(Request("display"))
Dim displayItem : displayItem = ""
Dim sql : sql = ""
Dim delay : delay = 10
Dim displayPages : displayPages = GetPagesInPresentation
' select the method to display the presentation
' There are two options:
' automatic display - uses the meta refresh tag to
' automatically display the next page.
' manual display - forces the user to click the
' next button manually to view the next page.
' manual display is the default.
if NOT lcase(displayMethod) = "auto" then
' set display to manual by default.
displayMethod = "manual"
end if
' find out what page we are displaying
If session("myPage") = "" Then
session("myPage") = 1
Else
session("myPage") = session("myPage") + 1
End If
' after we view the last page, start over at page 1
If clng(session("myPage")) > clng(displayPages) then session("myPage") = 1
' now we get the item to be displayed based on the current page
displayItem = GetDisplayItem
' MsgBox clng(displayItem),vbOKOnly
%>
Fiedler Barn Fire - 1991You are currently viewing this presentation using the <%=displayMethod%> change method. <% if displayMethod = "auto" then response.write "change to manual" else response.write "change to automatic (10 second delay)" end if %> Page: <%=session("myPage")%> of <%=displayPages%> |