djfenom
11-02-2005, 03:59 PM
I am doing a Case Studies page for a site I am working on. At the moment I have an initial page, "case_studies.asp", which lists the studies coming out of the database, with just the date and title and this then links off to another page "case_studies_display.asp". On this page, you get to see the full case study and picture.
My problem is on the display page, I would like "next" and "previous" buttons to get to the next or previous case study along. I've tried using the paging in Dreamweaver but because I've called the study from a previous page (ie the page name is case_studies_display.asp?id=5), it's not working.
Here is my current code:
case_studies.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/dearing.asp" -->
<%
Dim RScase
Dim RScase_numRows
Set RScase = Server.CreateObject("ADODB.Recordset")
RScase.ActiveConnection = MM_dearing_STRING
RScase.Source = "SELECT * FROM casestudies ORDER BY caseDate DESC"
RScase.CursorType = 0
RScase.CursorLocation = 2
RScase.LockType = 1
RScase.Open()
RScase_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
RScase_numRows = RScase_numRows + Repeat1__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
function DoDateTime(str, nNamedFormat, nLCID)
dim strRet
dim nOldLCID
strRet = str
If (nLCID > -1) Then
oldLCID = Session.LCID
End If
On Error Resume Next
If (nLCID > -1) Then
Session.LCID = nLCID
End If
If ((nLCID < 0) Or (Session.LCID = nLCID)) Then
strRet = FormatDateTime(str, nNamedFormat)
End If
If (nLCID > -1) Then
Session.LCID = oldLCID
End If
DoDateTime = strRet
End Function
</SCRIPT>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Dearing</title>
<script src="sifr.js" type="text/javascript"></script>
<script src="sifr-addons.js" type="text/javascript"></script>
<link href="sifr.css" rel="stylesheet" type="text/css" />
<link href="dearing.css" rel="stylesheet" type="text/css" />
</head>
<body id="case">
<!--#include file="nav.asp" -->
<div class="line"><img src="images/line-left.gif" /></div>
<div class="line" id="lineright"><img src="images/line-right.gif" /></div>
<div id="container">
<div class="column" id="double">
<h2>Case Studies</h2>
<div id="scrollable">
<%
While ((Repeat1__numRows <> 0) AND (NOT RScase.EOF))
%>
<h3><%= DoDateTime((RScase.Fields.Item("caseDate").Value), 1, 2057) %></h3>
<p class="bigger"><a href="case_studies_display.asp?id=<%=(RScase.Fields.Item("caseID").Value)%>"><%=(RScase.Fields.Item("caseTitle").Value)%></a></p>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
RScase.MoveNext()
Wend
%>
</div>
</div>
<div class="column" id="imgcol">
<img src="images/design-image.jpg" alt="Design and Manufacturing Image" width="220" height="262" />
<h3>Automotive Industry </h3>
</div>
</div>
<!--#include file="sifr_include.asp" -->
</body>
</html>
<%
RScase.Close()
Set RScase = Nothing
%>
case_studies_display.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/dearing.asp" -->
<%
Dim RScase__MMColParam
RScase__MMColParam = "1"
If (Request.QueryString("id") <> "") Then
RScase__MMColParam = Request.QueryString("id")
End If
%>
<%
Dim RScase
Dim RScase_numRows
Set RScase = Server.CreateObject("ADODB.Recordset")
RScase.ActiveConnection = MM_dearing_STRING
RScase.Source = "SELECT * FROM casestudies WHERE caseID = " + Replace(RScase__MMColParam, "'", "''") + ""
RScase.CursorType = 0
RScase.CursorLocation = 2
RScase.LockType = 1
RScase.Open()
RScase_numRows = 0
%>
<!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" />
<title>Dearing</title>
<script src="sifr.js" type="text/javascript"></script>
<script src="sifr-addons.js" type="text/javascript"></script>
<link href="sifr.css" rel="stylesheet" type="text/css" />
<link href="dearing.css" rel="stylesheet" type="text/css" />
</head>
<body id="case">
<!--#include file="nav.asp" -->
<div class="line"><img src="images/line-left.gif" /></div>
<div class="line" id="lineright"><img src="images/line-right.gif" /></div>
<div id="container">
<div class="column" id="double">
<h2>Case Studies</h2>
<div id="scrollable">
<h3><%=(RScase.Fields.Item("caseTitle").Value)%></h3>
<p>
<% Response.Write Replace(RScase.Fields.Item("caseContent"), vbCrLf, "<br>")%>
</p>
</div>
</div>
<div class="column" id="imgcol">
<div id="caseimg">
<% if (RScase("caseImg").Value) <> "" then %>
<%'***** Display picture *********************************%>
<%strPath = Server.URLEncode(Server.MapPath("case-images") & "\" & RScase("caseImg"))
set fso = createobject("scripting.filesystemobject")
if (fso.FileExists(Server.MapPath("case-images") & "\" & RScase("caseImg"))) then%>
<img src="sendbinary.asp?path=<%=strPath%>" />
<%
set fso = nothing
end if
'*******************************************************%>
<% end if %>
</div>
<ul>
<li class="nobg"><a href="#" title="previous article">< prev</a></li>
<li><a href="case_studies.asp" title="back to case studies index">index</a></li>
<li><a href="#" title="next article">next > </a></li>
</ul>
</div>
</div>
<!--#include file="sifr_include.asp" -->
</body>
</html>
<%
RScase.Close()
Set RScase = Nothing
%>
Thanks in advance.
Chris
My problem is on the display page, I would like "next" and "previous" buttons to get to the next or previous case study along. I've tried using the paging in Dreamweaver but because I've called the study from a previous page (ie the page name is case_studies_display.asp?id=5), it's not working.
Here is my current code:
case_studies.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/dearing.asp" -->
<%
Dim RScase
Dim RScase_numRows
Set RScase = Server.CreateObject("ADODB.Recordset")
RScase.ActiveConnection = MM_dearing_STRING
RScase.Source = "SELECT * FROM casestudies ORDER BY caseDate DESC"
RScase.CursorType = 0
RScase.CursorLocation = 2
RScase.LockType = 1
RScase.Open()
RScase_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
RScase_numRows = RScase_numRows + Repeat1__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
function DoDateTime(str, nNamedFormat, nLCID)
dim strRet
dim nOldLCID
strRet = str
If (nLCID > -1) Then
oldLCID = Session.LCID
End If
On Error Resume Next
If (nLCID > -1) Then
Session.LCID = nLCID
End If
If ((nLCID < 0) Or (Session.LCID = nLCID)) Then
strRet = FormatDateTime(str, nNamedFormat)
End If
If (nLCID > -1) Then
Session.LCID = oldLCID
End If
DoDateTime = strRet
End Function
</SCRIPT>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Dearing</title>
<script src="sifr.js" type="text/javascript"></script>
<script src="sifr-addons.js" type="text/javascript"></script>
<link href="sifr.css" rel="stylesheet" type="text/css" />
<link href="dearing.css" rel="stylesheet" type="text/css" />
</head>
<body id="case">
<!--#include file="nav.asp" -->
<div class="line"><img src="images/line-left.gif" /></div>
<div class="line" id="lineright"><img src="images/line-right.gif" /></div>
<div id="container">
<div class="column" id="double">
<h2>Case Studies</h2>
<div id="scrollable">
<%
While ((Repeat1__numRows <> 0) AND (NOT RScase.EOF))
%>
<h3><%= DoDateTime((RScase.Fields.Item("caseDate").Value), 1, 2057) %></h3>
<p class="bigger"><a href="case_studies_display.asp?id=<%=(RScase.Fields.Item("caseID").Value)%>"><%=(RScase.Fields.Item("caseTitle").Value)%></a></p>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
RScase.MoveNext()
Wend
%>
</div>
</div>
<div class="column" id="imgcol">
<img src="images/design-image.jpg" alt="Design and Manufacturing Image" width="220" height="262" />
<h3>Automotive Industry </h3>
</div>
</div>
<!--#include file="sifr_include.asp" -->
</body>
</html>
<%
RScase.Close()
Set RScase = Nothing
%>
case_studies_display.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/dearing.asp" -->
<%
Dim RScase__MMColParam
RScase__MMColParam = "1"
If (Request.QueryString("id") <> "") Then
RScase__MMColParam = Request.QueryString("id")
End If
%>
<%
Dim RScase
Dim RScase_numRows
Set RScase = Server.CreateObject("ADODB.Recordset")
RScase.ActiveConnection = MM_dearing_STRING
RScase.Source = "SELECT * FROM casestudies WHERE caseID = " + Replace(RScase__MMColParam, "'", "''") + ""
RScase.CursorType = 0
RScase.CursorLocation = 2
RScase.LockType = 1
RScase.Open()
RScase_numRows = 0
%>
<!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" />
<title>Dearing</title>
<script src="sifr.js" type="text/javascript"></script>
<script src="sifr-addons.js" type="text/javascript"></script>
<link href="sifr.css" rel="stylesheet" type="text/css" />
<link href="dearing.css" rel="stylesheet" type="text/css" />
</head>
<body id="case">
<!--#include file="nav.asp" -->
<div class="line"><img src="images/line-left.gif" /></div>
<div class="line" id="lineright"><img src="images/line-right.gif" /></div>
<div id="container">
<div class="column" id="double">
<h2>Case Studies</h2>
<div id="scrollable">
<h3><%=(RScase.Fields.Item("caseTitle").Value)%></h3>
<p>
<% Response.Write Replace(RScase.Fields.Item("caseContent"), vbCrLf, "<br>")%>
</p>
</div>
</div>
<div class="column" id="imgcol">
<div id="caseimg">
<% if (RScase("caseImg").Value) <> "" then %>
<%'***** Display picture *********************************%>
<%strPath = Server.URLEncode(Server.MapPath("case-images") & "\" & RScase("caseImg"))
set fso = createobject("scripting.filesystemobject")
if (fso.FileExists(Server.MapPath("case-images") & "\" & RScase("caseImg"))) then%>
<img src="sendbinary.asp?path=<%=strPath%>" />
<%
set fso = nothing
end if
'*******************************************************%>
<% end if %>
</div>
<ul>
<li class="nobg"><a href="#" title="previous article">< prev</a></li>
<li><a href="case_studies.asp" title="back to case studies index">index</a></li>
<li><a href="#" title="next article">next > </a></li>
</ul>
</div>
</div>
<!--#include file="sifr_include.asp" -->
</body>
</html>
<%
RScase.Close()
Set RScase = Nothing
%>
Thanks in advance.
Chris