<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% Dim MyConn Set MyConn=Server.CreateObject("ADODB.Connection") MyConn.Open(MM_HNISVRNODSN_STRING) set RS_news = Server.CreateObject("ADODB.Recordset") RS_news.ActiveConnection = MM_HNISVRNODSN_STRING RS_news.Source = "SELECT NEWS_ID, NEWS_TEASER, NEWS_ARTICLE, NEWS_IMAGE1, NEWS_IMAGE2, NEWS_IMAGE3, NEWS_PLACEMENT FROM "&strTablePrefix&"_newsimg WHERE NEWS_PLACEMENT ='0' Order by NEWS_ID desc" RS_news.CursorType = 0 RS_news.CursorLocation = 2 RS_news.LockType = 3 RS_news.Open() RS_news_numRows = 0 %> <% 'format article function 'create prpper directory names Function textareaformat(thestring) thestring= Replace(thestring,"--image1--",(RS_news.Fields.Item("news_IMAGE1").Value)) thestring= Replace(thestring,"--image2--",(RS_news.Fields.Item("news_IMAGE2").Value)) thestring= Replace(thestring,"--image3--",(RS_news.Fields.Item("news_IMAGE3").Value)) thestring= Replace(thestring,vbCrLf,"

") thestring= Replace(thestring,"chr(13)&chr(10)&chr(13)&chr(10)","

") thestring= Replace(thestring,"chr(13)&chr(10)","
") thestring= Replace(thestring,"chr(32)&chr(32)&chr(32)","   ") thestring= Replace(thestring,"chr(9)","        ") textareaformat = thestring End Function 'Dim RS_Testi, SQL, TestiName, ID 'set RS_Testi = Server.CreateObject("ADODB.Recordset") 'RS_Testi.ActiveConnection = MM_HNISVRNODSN_STRING 'SQL = "SELECT * FROM "&strTablePrefix&"_Testimonials ORDER BY TestiName" 'RS_Testi.Open(SQL) ' If Rs_Testi.EOF OR Rs_Testi.BOF Then ' PageMsg = "There are no testimonials to view at this time." ' End If %> MKS

 

TESTIMONIALS

<% ' Point to the next record RsTestimonial.MoveNext End If Next %>
<% ' Variables for the page number we want to show, and the total number of pages Dim mypage, numpages ' Variables for the total number of records, and the number of records we should show on one page Dim numrecs, pagesize ' Get the page number we need to display from Form or QueryString mypage = CInt( Request("page") ) ' If we aren't given one display page 1 If mypage=0 Then mypage=1 ' Get the requested number of records per page pagesize = CInt( Request("recs") ) ' Change 10 to whatever you want the default display to be If pagesize = 0 Then pagesize = 10 ' The code we need to set up a recordset object for paging Dim RsTestimonial, SQLString Set RsTestimonial = Server.CreateObject("ADODB.RecordSet") RsTestimonial.PageSize = pagesize RsTestimonial.CacheSize = pagesize RsTestimonial.CursorLocation = adUseClient SQLString = "SELECT * FROM "&strTablePrefix&"_Testimonials ORDER BY TestiName" RsTestimonial.Open SQLString, MyConn, adOpenForwardOnly, adLockReadOnly, adCmdText ' Get the number of pages and records numpages = RsTestimonial.PageCount numrecs = RsTestimonial.RecordCount ' Just in case we have a bad request If mypage > numpages Then mypage = numpages If mypage < 1 Then mypage = 1 ' This line sets the current page RsTestimonial.AbsolutePage = mypage ' Output the total number of records in the recordset Response.Write("

" & numrecs & " records found." ) ' Write the current page number and number of pages (eg "Page 4 of 7") Response.Write("
Page " & mypage & " of " & numpages & "

") ' Loop through the records for this page writing each on a new line Dim i For i=1 To pagesize ' Make sure we don't go past the last record If NOT RsTestimonial.EOF Then %>

<% =RsTestimonial("Testimonial") %>
- <% =RsTestimonial("TestiName") %>





Page:
<% ' Loop through the number of pages writing a link for each Dim x, lb, ub For x=1 To numpages ' lb is the lowest record number on that page, ub is the highest lb = (x-1) * pagesize + 1 ub = x * pagesize ' Makes sure the final link doesn't extend past to the # of records If ub > numrecs Then ub = numrecs ' Don't display the current page as a hyperlink If x <> mypage Then ' Example output: 75-100 Response.Write("" & x & "") Else ' The active page Response.Write(x) End If ' Writes | as a separator if we're not at the last link If x <> numpages Then Response.Write(" | ") Next %>

 

 

 

 

 

 

 

 

 

 

 

 

<% ' Clean-up RsTestimonial.Close Set RsTestimonial = Nothing RS_News.Close Set RS_News = Nothing MyConn.Close Set MyConn = Nothing %>