Tutorials to .com

Tutorials to .com » Asp » Skills » Build your web site news release system of the four automatic

Build your web site news release system of the four automatic

Print View , by: iSee ,Total views: 10 ,Word Count: 884 ,Date: Mon, 24 Aug 2009 Time: 9:59 PM

Immediately following the previous section, our news system has been able to complete daily news online to add, delete, etc., but this is still not enough, and some users may need to find a particular topic about the past, the content of news articles, and a ratio teach sound information systems, of course, not been immune from the completion of this function.
Now immediately add to our information systems on the (full text / title) of the search function bar, first of all we have done a search form, see the following HTML code, put the code on the need for an information retrieval of web pages. Can be for users to easily and News Search.
"Form method =" POST "action =" http://XXX..com.cn/cgi-win/search/search.asp ""
"P" "select name =" select "size =" 1 ""
"Option selected value =" search_1 "" Information Retrieval (title) "/ option"
"Option value =" search_2 "" Information Retrieval (full text) "/ option"
"/ Select" "input type =" text "name =" key "size =" 20 "" "input type =" submit "value =" Search "
name = "search" "" / p "
"/ Form"

In this FORM to add on the basis of the asp program dealing with the search search.asp. With the key in the form we use this parameter to indicate a need to match the string, while the select parameter specifies the full-text search is based on the title search.
Now proceed to the procedure part of a look at our search.asp program.
* Search.asp
"% @ Language =" vbscript "%"
"%
if request.form ( "key ")="" then
response.redirect "/"
end if

select case request.form ( "select")
case "search_1"
% "
"!--# Include Virtual = "/ cgi-win/search/news/data.inc" - "
"%
Set rs_1 = Server.CreateObject ( "ADODB.Recordset")
sql = "select * from data where instr (news_title, '" & request.form ( "key ")&"')" 0"
sql = sql + "Order by news_id Desc, news_class ASC"
rs_1.open sql, conn_1, 3,2
case "search_2"
% "
"!--# Include Virtual = "/ cgi-win/search/news/data.inc" - "
"%
Set rs_1 = Server.CreateObject ( "ADODB.Recordset")
sql = "select * from data where instr (news_comment, '" & request.form ( "key ")&"')" 0"
sql = sql + "Order by news_id Desc, news_class ASC"
rs_1.open sql, conn_1, 3,2


end select


if rs_1.bof then
response.redirect "/"
response.end
end if

rs_1.movefirst

dispmess = "" table border = 0 width = 100% cellpadding = 0 cellspacing = 0 class = a9 ""
disp = ""


do while not rs_1.eof
if not rs_1.eof then
disp = disp & "" tr "" td "" a href = http://www.aaaaa.com.cn/news/read.asp?news_id = "& rs_1 (" news_id ") &" target = _blank "" "" & rs_1 ( "news_title ")&"" font size = 1" ( "& rs_1 (" news_month ")&"-"& rs_1 ( "news_day ")&")"/ font" "/ a" "/ td" "/ tr "" / p ""
rs_1.movenext
end if
loop
dispmess = dispmess & disp

dispmess = dispmess & "" / table ""
'dispmess = "document.write ('" & dispmess &"')"


% "
"% = Dispmess%"
KEY through the incoming parameters and select (text or title search parameters), generate a SQL query, respectively, in the title of a database field or in the content of the field to check whether the string contains a key, such as on-off any If our results add record set and finally the news headlines displayed. Of course, the output interface to meet your personal needs, to customize their own here is not used to display the page. We can in this news release based on the system, combined with your own needs, put it even more perfect the design.
At this point, we have set of personal website automated news publishing system are basically making is completed.


ASP skills Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.