1. Sample form:
<formname= "Topfrm"ID= "Topfrm"Action= "/search.asp"> <inputname= "SearchType"type= "hidden"value= "3"ID= "SearchType" /> <inputname= "Keys"type= "hidden"value= "All"ID= "Keys" /> <Divclass= "Search-li"> <inputname= "Title"type= "text"class= "Search-input"ID= "Title" /> <span>Project Name:</span></Div> <Divclass= "Search-li"> <inputclass= "Search-input"name= "P_area"type= "text"ID= "P_area" /> <span>Regional:</span></Div> <Divclass= "Search-li"> <inputclass= "Search-input"name= "P_room"type= "text"ID= "P_room" /> <span>Room Type:</span></Div> <Divclass= "Search-li"> <inputclass= "Search-input"name= "P_cost"type= "text"ID= "P_cost" /> <span>Cost:</span></Div> <Divclass= "Search-li"> <inputclass= "Search-input"name= "P_designstyle"type= "text"ID= "P_designstyle" /> <span>Style:</span></Div> <Divclass= "Search-btn"><ahref= "Javascript:topsearchsubmit ();"><imgsrc= "{aspcms:sitepath}/templates/{aspcms:defaulttemplate}/images/search_btn.gif" /></a></Div> </form>
<script type= "Text/javascript" > function topsearchsubmit () { topfrm.submit (); return false ; } </script>
2. Modify "/inc/aspcms_mainclass.asp", modify the query statement (1484 lines in the source code)
' Aspcms Start ' Dim typestr:typestr= ' "' Dim SearchType ' Searc Htype=filterpara (GetForm ("SearchType", "get")) ' If Isnul (searchtype) then searchtype= ' 0 ' If not ' 0 ' =searchtype then typestr= ' and A.sortid in (select {Prefix}sort.sortid from {prefix}sort where sorttype= ') &searchtype& ") "' Sql=" select Contentid,a.sortid,a.groupid,a.exclusive,title,title2,titlecolor,isoutlink,outlink, Author,contentsource,contenttag,content,contentstatus,istop,isrecommend,isimagenews,isheadline,isfeatured, Contentorder,isgenerated,visits,a.addtime,a.[imagepath],a.indeximage,a.downurl,a.pagefilename,a.pagedesc, Sorttype,sorturl,sortfolder,sortfilename,sortname,contentfolder,contentfilename,b.groupid "&sperstr& "from {prefix}content as a,{prefix}sort as B where a.languageid="&setting.languageid& "and A.sortid=b.sortid and Contentstatus=1 and Timestatus=0 and A.sortid in ("&getsubsort(Typeids, 1) & ") and Title like '% '&keys& "% '"&typestr&orderstr' Aspcms End
Change the above into:
' Feva startdim typestr:typestr= ' "Dim Searchtypesearchtype=filterpara (GetForm (" SearchType "," get ")) If Isnul ( SearchType) then searchtype= ' 0 ' If not ' 0 ' =searchtype then typestr= ' and A.sortid in ' (select {Prefix}sort.sortid from {Pre Fix}sort where sorttype= "&searchtype& ") ' If not keys= ' all ' then sql= ' select Contentid,a.sortid,a.groupid,a.exclusive,title,title2,titlecolor,isoutlink,ou Tlink,author,contentsource,contenttag,content,contentstatus,istop,isrecommend,isimagenews,isheadline, Isfeatured,contentorder,isgenerated,visits,a.addtime,a.[imagepath],a.indeximage,a.downurl,a.pagefilename,a. Pagedesc,sorttype,sorturl,sortfolder,sortfilename,sortname,contentfolder,contentfilename,b.groupid "&sperstr& "from {prefix}content as a,{prefix}sort as B where a.languageid="&setting.languageid& "and A.sortid=b.sortid and Contentstatus=1 and Timestatus=0 and A.sortid in ("&getsubsort(Typeids, 1) & ") and Title like '% '&keys& "% '"&typestr&orderstrelse Dim formInput, keyValue, tempstring:tempstring = "" For each formInput in Reque St. QueryString If Not formInput = ' searchtype ' and not formInput = ' keys ' and ' not ' formInput = ' page ' Then KeyValue = Filterpara (GetForm (FormInput, "get")) If Len (KeyValue) > 0 and Len (Filterpara (formInput)) > 0 Then tempstring = tempstring & "and" & FormInput & "Like '%" & keyValue & "% '" End If End If Next tempstring = tempstring & "sql=" Select Contentid,a.sortid,a.groupid,a.ex Clusive,title,title2,titlecolor,isoutlink,outlink,author,contentsource,contenttag,content,contentstatus,istop, Isrecommend,isimagenews,isheadline,isfeatured,contentorder,isgenerated,visits,a.addtime,a.[imagepath],a. Indeximage,a.downurl,a.pagefilename,a.pagedesc,sorttype,sorturl,sortfolder,sortfilename,sortname,contentfolder , Contentfilename,b.groupid "&sperstr& "from {prefix}content as a,{prefix}sort as B where a.languageid="&setting.languageid& "and A.sortid=b.sortid and Contentstatus=1 and Timestatus=0 and A.sortid in ("&getsubsort(Typeids, 1) & ")" & TempString&typestr&orderstrEnd If ' Feva end
3. Modify the "/inc/aspcms_commonfun.asp" and add the function:
' Feva Start ' multi-conditional paging using function Conditionsearch () Dim Keys:keys = Filterpara (GetForm ("Keys", "get")) If not keys= "All" Then ' strpagenumber=strpagenumber& '<ahref=""? page= "&pagenumber&"&keys= "&keys&"&searchtype= "&searchtype&""">"&pagenumber& "</a>"Conditionsearch =" "Exit Function Else Dim formInput, KeyValue, Tempstring:tempst Ring = "" For each formInput in request.querystring If not formInput = "SearchType" and not formInput = "Keys" and not FormInput = "page" Then KeyValue = Filterpara (GetForm (FormInput, "get")) If L En (KeyValue) > 0 and Len (Filterpara (formInput)) > 0 Then tempstring = tempstring & "&" &A mp FormInput & "=" & KeyValue End If End If Next conditionsearch = Tempstrin G Exit Function ' strpagenumber=strpagenumber& '<ahref=""? page= "&pagenumber&"&keys= "&keys&"&searchtype= "&searchtype&tempString&""">"&pagenumber& "</a>"End IfEnd Function ' Feva end
3. Modify "/inc/aspcms_commonfun.asp", the middle function makepagenumber (Byval currentpage,byval pagelistlen,byval totalpages , Byval linktype,byval SortID, Byval showtype) Modified:
' Aspcms Start ' strpagenumber=strpagenumber&'<href= ""? Page = "&pagenumber&" &keys = "&keys&" &searchtype = "&searchtype&" "" >"&pagenumber&</a>" ' Aspcms End
Modified to:
"Feva Start ' note searchtype case problem strpagenumber=strpagenumber&" < a href = "" =" &pagenumber& " &keys Span style= "color: #ff0000;" >&searchtype = "&searchtype& Conditionsearch () &" " > " &pagenumber & " </ a >
4. Modify "/inc/aspcms_commonfun.asp", the function pagenumberlinkinfo on both sides of the page (Byval currentpage,byval pagelistlen,byval Totalpages,byval linktype,byval SortID, Byval showtype) modified
' aspcms Start ' firstpagelink= '<ahref= '? page=1&keys= ' &keys& ' &searchtype= ' &searchtype& ' '>"&str_01& "</a>": lastpagelink="<ahref= '? page= ' ¤tPage-1& ' &keys= ' &keys& ' &searchtype= ' &searchtype& ' '>"&str_03& "</a>"' Aspcms End
Modified to:
' Feva Start firstpagelink= '<ahref= '? page=1&keys= ' &keys& ' &searchtype= ' &searchtype&conditionSearch&"'>"&str_01& "</a>": lastpagelink="<ahref= '? page= ' ¤tPage-1& ' &keys= ' &keys& ' &searchtype= ' &searchtype& conditionsearch& "'>"&str_03& "</a>"' Feva End
It's done, tried, there's no error aspcms 2.5.4 Beta 2 July 28, 2014
ASPCMS Multi-Criteria Query