<% Dim rsJournal 'Database recordset holding the Journal items Dim rsCommentsCount 'Database recordset holding the count of comments for each Journal item Dim intRecordPositionPageNum 'Holds the number of the page the user is on Dim intRecordLoopCounter 'Loop counter to loop through each record in the recordset Dim intTotalNumJournalEntries 'Holds the number of Journal Items there are in the database Dim intTotalNumJournalPages 'Holds the number of pages the Journal Items cover Dim intLinkPageNum 'Holds the number of the other pages of Journal itmes to link to 'If this is the first time the page is displayed then set the record position is set to page 1 If Request.QueryString("PagePosition") = "" Then intRecordPositionPageNum = 1 'Else the page has been displayed before so the Journal item record postion is set to the Record Position number Else intRecordPositionPageNum = CInt(Request.QueryString("PagePosition")) End If %>
<% DisplayContent 2,1392,1,12,0,1,0,0,0,0,1,0,"Links","140","topic.asp" %> <% 'Create recorset object Set rsJournal = Server.CreateObject("ADODB.Recordset") 'Initalise the strSQL variable with an SQL statement to query the database strSQL = "SELECT tblJournal.* FROM tblJournal ORDER BY Date_stamp DESC;" 'Set the cursor type property of the record set to dynamic so we can naviagate through the record set rsJournal.CursorType = 3 'Query the database rsJournal.Open strSQL, adoCon 'Set the number of records to display on each page by the constant set in the common.asp file rsJournal.PageSize = intRecordsPerPage 'Get the record poistion to display from If NOT rsJournal.EOF Then rsJournal.AbsolutePage = intRecordPositionPageNum 'Create recorset object Set rsCommentsCount = Server.CreateObject("ADODB.Recordset") 'If there are no rcords in the database display an error message If rsJournal.EOF Then 'Tell the user there are no records to show Response.Write "
There are no Journal Items to read" Response.Write "
Please check back later
" Response.Write "

" Response.Write "Photo Album    Administrator Options

" Response.End 'Display the Journal Items Else 'Count the number of Journal Items database intTotalNumJournalEntries = rsJournal.RecordCount 'Count the number of pages of Journal Items there are in the database calculated by the PageSize attribute set above intTotalNumJournalPages = rsJournal.PageCount 'Display the HTML number number the total number of pages and total number of records %>

There are <% = intTotalNumJournalEntries %> Journal Items in <% = intTotalNumJournalPages %> pages and your are on page number <% = intRecordPositionPageNum %>

<% 'For....Next Loop to display the Journal Items in the database For intRecordLoopCounter = 1 to intRecordsPerPage 'If there are no records then exit for loop If rsJournal.EOF Then Exit For 'Get the count of comments from the db strSQL = "SELECT Count(tblComments.Journal_ID) AS CountOfJournalItems " strSQL = strSQL & "FROM tblComments " strSQL = strSQL & "WHERE tblComments.Journal_ID = " & CLng(rsJournal("Journal_ID")) & ";" 'Query the database rsCommentsCount.Open strSQL, adoCon %>
<% = rsJournal("Journal_title") %>
<% = rsJournal("Journal_item") %>
Posted by <% 'If there is an email address entered make it a mailto link If rsJournal("Author_email") <> "" Then Response.Write("" & rsJournal("Author") & "") Else Response.Write(rsJournal("Author")) %> on <% = FormatDateTime(rsJournal("Date_stamp"), vbLongDate) %> at <% = FormatDateTime(rsJournal("Date_stamp"), vbShortTime) %><% 'If commets are allowed for this itm show a links to the comments page If CBool(rsJournal("Comments")) = True Then %> &PagePosition=<% = intRecordPositionPageNum %>" target="_self" style="font-size: <% = intSmallTextSize %>px">Comments <% If NOT rsCommentsCount.EOF Then Response.Write "(" & rsCommentsCount("CountOfJournalItems") & ")" Else Response.Write "(0)" End If End If %>

<% 'Close the count recordset rsCommentsCount.Close 'Move to the next record in the recordset rsJournal.MoveNext Next End If 'Display an HTML table with links to the other Journal Items %>
<% 'If there are more pages to display then add a title to the other pages If intRecordPositionPageNum > 1 or NOT rsJournal.EOF Then Response.Write vbCrLf & " Page: " End If 'If the Journal Items page number is higher than page 1 then display a back link If intRecordPositionPageNum > 1 Then Response.Write vbCrLf & " << Prev " End If 'If there are more pages to display then display links to all the pages If intRecordPositionPageNum > 1 or NOT rsJournal.EOF Then 'Display a link for each page in the Journal Items For intLinkPageNum = 1 to intTotalNumJournalPages 'If the page to be linked to is the page displayed then don't make it a hyper-link If intLinkPageNum = intRecordPositionPageNum Then Response.Write vbCrLf & " " & intLinkPageNum Else Response.Write vbCrLf & " " & intLinkPageNum & " " End If Next End If 'If it is Not the End of the Journal Items entries then display a next link for the next Journal Items page If NOT rsJournal.EOF then Response.Write vbCrLf & " Next >>" End If 'Finsh HTML the table %>


<% 'Reset server objects rsJournal.Close Set rsJournal = Nothing Set rsCommentsCount = Nothing Set strCon = Nothing Set adoCon = Nothing %>

Photo Album    Administrator Options