![]() |
|||||
Home
| Listă cursuri | Cum
funcționează | Demo |
Înscriere |Argument |
Știri | Articole | F.
A. Q. | Suport | |
|||||
![]() |
<%
Dim adoCon 'Database Connection Variable
Dim rsConfiguration 'Holds the configuartion recordset
Dim strCon 'Holds the Database driver and the path and name of the database
Dim strSQL 'Holds the SQL query for the database
Dim intRecordsPerPage 'Holds the number of files shown on each page
Dim strBgColour 'Holds the background colour of the News Administrator
Dim strTextColour 'Holds the text colour of the News Administrator
Dim strTextType 'Holds the font type of the News Administrator
Dim intHeadingTextSize 'Holds the heading font size
Dim intTextSize 'Holds the font size of the News Administrator
Dim intSmallTextSize 'Holds the small font size
Dim strLinkColour 'Holds the link colour of the News Administrator
Dim strTableColour 'Holds the table colour
Dim strTableBorderColour 'Holds the table border colour
Dim strTableTitleColour 'Holds the table title colour
Dim strVisitedLinkColour 'Holds the visited link colour of the News Administrator
Dim strActiveLinkColour 'Holds the active link colour of the News Administrator
Dim blnLCode 'set to true
Dim blnEmail 'Boolean set to true if e-mail is on
Dim strCode 'Holds the page code
Dim strCodeField 'Holds the code type
Dim strWebSiteEmailAddress 'Holds the e-mail address for the web site the Site News is on
Dim strMailComponent 'Email coponent the site news app useses
Dim strSMTPServer 'SMTP server for sending the e-mails through
Dim strLoggedInUserCode 'Holds the user code of the user
Dim strTitleImage 'Holds the path and name for the title image for the site news
Dim intMsgCharNo 'Holds the number of characters allowed for the messages
Dim blnCookieSet 'Set to true if cookies are to be set to stop multiple posts
Dim blnIPBlocking 'Set to true if IP blooking is to be used to stop multiple posts
Set adoCon = Server.CreateObject("ADODB.Connection")
'Database connection info and driver
strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../db/news.mdb")
'Set an active connection to the Connection object
adoCon.Open strCon
'Set up the page encoding
strCodeField = "Code"
strCode = "nolinks2002"
'Intialise the ADO recordset object
Set rsConfiguration = Server.CreateObject("ADODB.Recordset")
'Initialise the SQL variable with an SQL statement to get the configuration details from the database
strSQL = "SELECT tblConfiguration.* From tblConfiguration;"
'Query the database
rsConfiguration.Open strSQL, strCon
'If there is config deatils in the recordset then read them in
If NOT rsConfiguration.EOF Then
'Read in the configuration details from the recordset
intRecordsPerPage = CInt(rsConfiguration("No_records_per_page"))
strBgColour = rsConfiguration("bg_colour")
strTextColour = rsConfiguration("text_colour")
strTextType = rsConfiguration("text_type")
intHeadingTextSize = CInt(rsConfiguration("heading_text_size"))
intTextSize = CInt(rsConfiguration("text_size"))
intSmallTextSize = CInt(rsConfiguration("small_text_size"))
strTableColour = rsConfiguration("table_colour")
strTableBorderColour = rsConfiguration("table_border_colour")
strTableTitleColour = rsConfiguration("table_title_colour")
strLinkColour = rsConfiguration("links_colour")
strVisitedLinkColour = rsConfiguration("visited_links_colour")
strActiveLinkColour = rsConfiguration("active_links_colour")
strWebSiteEmailAddress = rsConfiguration("email_address")
blnLCode = CBool(rsConfiguration("Code"))
blnEmail = CBool(rsConfiguration("email_notify"))
strTitleImage = rsConfiguration("Title_image")
intMsgCharNo = rsConfiguration("Message_char_no")
blnCookieSet = CBool(rsConfiguration("Cookie"))
blnIPBlocking = CBool(rsConfiguration("IP_blocking"))
strMailComponent = rsConfiguration("mail_component")
strSMTPServer = rsConfiguration("mail_server")
End If
'Reset server object
rsConfiguration.Close
Set rsConfiguration = Nothing
%>
<%
Dim rsNews 'Database recordset holding the news items
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 intTotalNumNewsEntries 'Holds the number of News Items there are in the database
Dim intTotalNumNewsPages 'Holds the number of pages the News Items cover
Dim intLinkPageNum 'Holds the number of the other pages of news 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 news item record postion is set to the Record Position number
Else
intRecordPositionPageNum = CInt(Request.QueryString("PagePosition"))
End If
%>
<%
'Create recorset object
Set rsNews = Server.CreateObject("ADODB.Recordset")
'Initalise the strSQL variable with an SQL statement to query the database by selecting all tables ordered by the decending date
strSQL = "SELECT tblNews.* FROM tblNews ORDER BY News_Date DESC;"
'Set the cursor type property of the record set to dynamic so we can naviagate through the record set
rsNews.CursorType = 3
'Query the database
rsNews.Open strSQL, adoCon
'Set the number of records to display on each page by the constant set in the common.asp file
rsNews.PageSize = intRecordsPerPage
'Get the record poistion to display from
If NOT rsNews.EOF Then rsNews.AbsolutePage = intRecordPositionPageNum
'If there are no rcords in the database display an error message
If rsNews.EOF Then
'Tell the user there are no records to show
Response.Write " There are no News Items to read" Response.Write " Please check back later" Response.End 'Display the News Items Else 'Count the number of News Items database intTotalNumNewsEntries = rsNews.RecordCount 'Count the number of pages of News Items there are in the database calculated by the PageSize attribute set above intTotalNumNewsPages = rsNews.PageCount 'Display the HTML number number the total number of pages and total number of records %>
<% 'For....Next Loop to display the News Items in the database For intRecordLoopCounter = 1 to intRecordsPerPage 'If there are no records then exit for loop If rsNews.EOF Then Exit For %>
<% 'Move to the next record in the recordset rsNews.MoveNext Next End If 'Display an HTML table with links to the other News Items %>
|
||||
Home
| Listă cursuri | Cum
funcționează | Demo |
Înscriere |Argument |
Știri | Articole | F.
A. Q. | Suport | |
|||||
(c) 2004 - Soft
4 Web - O divizie a Direct
Learning Systems |
|||||

