<%@LANGUAGE="VBSCRIPT"%> <% curpath = "http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL") curpath = Left(curpath, InstrRev(curpath, "/")) %> <% Dim rsBlogSite Dim rsBlogSite_numRows Set rsBlogSite = Server.CreateObject("ADODB.Recordset") rsBlogSite.ActiveConnection = MM_blog_STRING rsBlogSite.Source = "SELECT * FROM tblBlogRSS" rsBlogSite.CursorType = 0 rsBlogSite.CursorLocation = 2 rsBlogSite.LockType = 1 rsBlogSite.Open() rsBlogSite_numRows = 0 %> <% Dim rsCats Dim rsCats_numRows Set rsCats = Server.CreateObject("ADODB.Recordset") rsCats.ActiveConnection = MM_blog_STRING rsCats.Source = "SELECT *, (SELECT COUNT(*) FROM tblBlog WHERE tblBlog.BlogCat = tblCat.CatID) as CatCount FROM tblCat ORDER BY CatName ASC" rsCats.CursorType = 0 rsCats.CursorLocation = 2 rsCats.LockType = 1 rsCats.Open() rsCats_numRows = 0 %> <% Dim rsArchives Dim rsArchives_numRows Set rsArchives = Server.CreateObject("ADODB.Recordset") rsArchives.ActiveConnection = MM_blog_STRING rsArchives.Source = "SELECT DISTINCT Month(BlogDate) as ArchiveMonth, Year(BlogDate) as ArchiveYear FROM tblBlog ORDER BY Year(BlogDate) DESC, Month(BlogDate) DESC" rsArchives.CursorType = 0 rsArchives.CursorLocation = 2 rsArchives.LockType = 1 rsArchives.Open() rsArchives_numRows = 0 %> <% searchterm = Request("search") %> <% Dim rsSearch Dim rsSearch_numRows Set rsSearch = Server.CreateObject("ADODB.Recordset") rsSearch.ActiveConnection = MM_blog_STRING rsSearch.Source = "SELECT * , (SELECT COUNT(*) FROM tblComment WHERE tblComment.BlogID = tblBlog.BlogID AND tblComment.CommentInclude = 1) as CommentCount, (SELECT COUNT(*) FROM tblBlog WHERE BlogCat = CatID) as CategoryCount FROM tblBlog, tblCat, tblAuthor WHERE BlogCat = CatID AND BlogHeadline LIKE '%" + searchterm + "%' OR BlogHTML LIKE '% " + searchterm + "%' AND tblBlog.BlogAuthor = tblAuthor.fldAuthorID ORDER BY BlogDate DESC" rsSearch.CursorType = 0 rsSearch.CursorLocation = 2 rsSearch.LockType = 1 rsSearch.Open() rsSearch_numRows = 0 %> <% Dim rsRecent Dim rsRecent_numRows Set rsRecent = Server.CreateObject("ADODB.Recordset") rsRecent.ActiveConnection = MM_blog_STRING rsRecent.Source = "SELECT * FROM tblBlog ORDER by BlogDate DESC" rsRecent.CursorType = 0 rsRecent.CursorLocation = 2 rsRecent.LockType = 1 rsRecent.Open() rsRecent_numRows = 0 %> <% FUNCTION CropSentence(strText, intLength, strTrial) Dim wsCount Dim intTempSize Dim intTotalLen Dim strTemp wsCount = 0 intTempSize = 0 intTotalLen = 0 intLength = intLength - Len(strTrial) strTemp = "" IF Len(strText) > intLength THEN arrTemp = Split(strText, " ") FOR EACH x IN arrTemp IF Len(strTemp) <= intLength THEN strTemp = strTemp & x & " " END IF NEXT CropSentence = Left(strTemp, Len(strTemp) - 1) & strTrial ELSE CropSentence = strText END IF END FUNCTION %> <% Dim Repeat1__numRows Dim Repeat1__index Repeat1__numRows = -1 Repeat1__index = 0 rsBlogSite_numRows = rsBlogSite_numRows + Repeat1__numRows %> <% Dim Repeat2__numRows Dim Repeat2__index Repeat2__numRows = -1 Repeat2__index = 0 rsArchives_numRows = rsArchives_numRows + Repeat2__numRows %> <% Dim Repeat4__numRows Dim Repeat4__index Repeat4__numRows = 10 Repeat4__index = 0 rsRecent_numRows = rsRecent_numRows + Repeat4__numRows %> <% Dim Repeat3__numRows Dim Repeat3__index Repeat3__numRows = 20 Repeat3__index = 0 rsSearch_numRows = rsSearch_numRows + Repeat3__numRows %> <%=(rsBlogSite.Fields.Item("blogTitle").Value)%> > Search results for "<%=searchterm%>" " />
<% if rsSearch.EOF then %>

Your search term "<%=searchterm%>" returned no results. Please try another word or phrase.

<% Else %> <% While ((Repeat3__numRows <> 0) AND (NOT rsSearch.EOF)) %> <% if lastid <> rsSearch.Fields.Item("BlogID").Value then %> <% if lastdate <> DoDateTime((rsSearch.Fields.Item("BlogDate").Value), 1, 1033) then%>

<%= DoDateTime((rsSearch.Fields.Item("BlogDate").Value), 1, 1033) %>

<%end if%>

"><%=(rsSearch.Fields.Item("BlogHeadline").Value)%>

<% =(CropSentence(CI_StripHTML(rsSearch.Fields.Item("BlogHTML").Value), 250, "...")) %>

<% end if %> <% Repeat3__index=Repeat3__index+1 Repeat3__numRows=Repeat3__numRows-1 lastdate = DoDateTime((rsSearch.Fields.Item("BlogDate").Value), 1, 1033) lastid = rsSearch.Fields.Item("BlogID").Value rsSearch.MoveNext() Wend %> <% end if %>
<% rsBlogSite.Close() Set rsBlogSite = Nothing %> <% rsCats.Close() Set rsCats = Nothing %> <% rsArchives.Close() Set rsArchives = Nothing %> <% rsSearch.Close() Set rsSearch = Nothing %> <% rsRecent.Close() Set rsRecent = Nothing %>