%option explicit%>
<%
dim rsPosts, rsPostTypes, strSQL
dim strOrder, strDirection, strFilter
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Pages variables
dim intPage_Per_Count, intPage, intStart, intPages, intRowCount, i
if Request.QueryString("page") = "" then intPage = 1 else intPage = Request.QueryString("page")
intPage_Per_Count = 20 ' Change this for results per page setting
intStart = StartingRecord(intPage, intPage_Per_Count)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
set rsPosts = Server.CreateObject("ADODB.RecordSet")
set rsPostTypes = Server.CreateObject("ADODB.RecordSet")
strOrder = Request.QueryString("order")
strDirection = UCase(Request.QueryString("direction"))
strFilter = Request.QueryString("post_type")
strSQL = "SELECT tblPost.*, tblPost_Type.Post_Type " &_
"FROM tblPost_Type INNER JOIN tblPost ON tblPost_Type.ID_Post_Type = tblPost.ID_Post_Type " &_
"WHERE Inactive = 0"
if strFilter <> "" and strFilter <> "0" then
strSQL = strSQL & " AND tblPost.ID_Post_Type = " & strFilter
end if
if strOrder = "" then
strOrder = "strTitle"
strDirection = "ASC"
end if
select case strOrder
case "strTitle":
strSQL = strSQL & " ORDER BY LCASE(strTitle) " & strDirection
case "dtDateAdded":
strSQL = strSQL & " ORDER BY dtDateAdded " & strDirection
case "Post_Type":
strSQL = strSQL & " ORDER BY Post_Type " & strDirection
end select
rsPosts.Open strSQL, oConn, 1, 3
if not rsPosts.EOF then
intRowCount = rsPosts.RecordCount
rsPosts.Move(intStart - 1)
else
intRowCount = 0
end if
intPages = Pages(intRowCount, intPage_Per_Count)
%>
Guidelines web site - Posting list
<%
dim This_Page : This_Page = "post"
%>
Posts list
View only:
--View All--
<%
rsPostTypes.Open "SELECT * FROM tblPost_Type ORDER BY Post_Type ASC", oConn, 1, 3
do while not rsPostTypes.EOF%>
" <%if strFilter = CStr(rsPostTypes("ID_Post_Type")) then%>selected<%end if%>><%=rsPostTypes("Post_Type")%>
<%rsPostTypes.MoveNext
loop
rsPostTypes.Close : set rsPostTypes = nothing%>
Add new
<%if rsPosts.EOF then%>
There are no posts right now. Please check back later.
<%else%>
DESC<%else%>ASC<%end if%>'">
<%if strOrder = "strTitle" and strDirection = "ASC" then%>
↓
<%elseif strOrder = "strTitle" and strDirection = "DESC" then%>
↑
<%end if%>DESC<%else%>ASC<%end if%>">Title
DESC<%else%>ASC<%end if%>'">
<%if strOrder = "dtDateAdded" and strDirection = "ASC" then%>
↓
<%elseif strOrder = "dtDateAdded" and strDirection = "DESC" then%>
↑
<%end if%>DESC<%else%>ASC<%end if%>">Date Added
DESC<%else%>ASC<%end if%>'">
<%if strOrder = "Post_Type" and strDirection = "ASC" then%>
↓
<%elseif strOrder = "Post_Type" and strDirection = "DESC" then%>
↑
<%end if%>DESC<%else%>ASC<%end if%>">Site section
<%for i = 1 to intPage_Per_Count
if not rsPosts.EOF then%>
'" id="td_title_<%=rsPosts("ID_Post")%>" onmouseover="post_on('<%=rsPosts("ID_Post")%>')" onmouseout="post_off('<%=rsPosts("ID_Post")%>')" class="td_posts_body" width="61%">"><%=rsPosts("strTitle")%>
'" id="td_dtDateAdded_<%=rsPosts("ID_Post")%>" onmouseover="post_on('<%=rsPosts("ID_Post")%>')" onmouseout="post_off('<%=rsPosts("ID_Post")%>')" class="td_posts_body" width="13%">"><%=Day(rsPosts("dtDateAdded")) & " " & MonthName(Month(rsPosts("dtDateAdded")), true) & " " & Year(rsPosts("dtDateAdded"))%>
'" id="td_Post_Type_<%=rsPosts("ID_Post")%>" onmouseover="post_on('<%=rsPosts("ID_Post")%>')" onmouseout="post_off('<%=rsPosts("ID_Post")%>')" class="td_posts_body td_posts_body_right" width="13%">"><%=rsPosts("Post_Type")%>
<%rsPosts.MoveNext
end if
next
rsPosts.Close : set rsPosts = nothing%>
<%end if%>
<%
function StartingRecord(intPage, intPerPage)
StartingRecord = ((intPage - 1) * intPerPage) + 1
end function
function Pages(intTotal, intPer)
Pages = Fix(intTotal / intPer) + 1
if intTotal mod intPer = 0 then Pages = Pages - 1
end function
%>