Update Daily News content, for the webmaster is a very headache, first of all, collect a lot of news materials, but also have to make a lot of web pages, every day big and small international news, domestic news, it news, can really you tired. The most fatal point, these loose news is not managed, can not query, can not be online dynamic pruning, news stressing timeliness, when you make a good web page and then uploaded to the server, I am afraid that others have you a step, the news report out. Really thankless, for now our internet environment, online publishing news, dynamic generation of news pages, to add search for news, find the function is essential.
So, how do you use ASP technology to implement a dynamic news publishing system? and the news system practices generally have two kinds, one is to input the news content automatically by the program directly generated HTML files, such as by date and news ID number to do the name of HTM file, we often can see from some big news station such processing. And the other is to directly save the news data to the database, when users read the news. Data from the database, dynamically generated pages.
What is the difference between the two treatments? The first kind of display speed and the negative to the server, is the lightest. For the large flow of the site, speed is life, the site is too slow, who will go to the cable? The latter method is easier to deal with than to teach. Maintenance is also convenient, there are two kinds of double knot, because only the application database can easily handle the query, so that the reader to guide the corresponding news page, combined with the above methods, can be said to be different, now we mainly introduce the kind of dynamic page using the database method.
From the processing process, the main is to provide a management news page (can add and delete Daily News, including news pictures, titles, etc.), and then in to call the news Display page processing. The filter to the news need to be inserted into different styles of the page, so you can not use a fixed format page to display news feeds. They should be made into a pluggable part of the home page, so you can invoke the news on different styles of pages. Just like the following script statement
"Script language=" JavaScript "src=" http//xxx.com.cn/special/linux/lnews/autoup.asp "
"/script"
Finally, there is a detailed content page for reading the news. In general, a program that can complete an online news release consists of four major programs
Addnew.asp (used to save news data to the database) delete.asp (for processing Delete news)
Autoup.asp (used to handle the display of news headlines, that is, to insert the part of the homepage) read.asp (details of dynamically generated news)
Part of the support process is set_disp.asp (for handling the number of news on the home page, etc.)
Of course, the essential thing is a news database.
(i) Building a news database
Analyze the elements that make up each piece of news, mainly by news headlines, news content, picture address, connection address, news release time. And when you build the database. For processing needs, the ID number of the news must be added for identification. In addition, click Statistics can be added in order to understand what the reader is interested in. An Access database is an over time database that is ideal for use in the development phase, so. We construct a news database (Data.mdb) as follows
Table Data
NEWS_ID Long News Number
Category of News_class text News
News_class_name Text News category name
Title of News_title Text News
News_head Logic whether home display
The content of News_comment Comment News
Year of news_year Text news
month of News_month text news
Content of News_day Text news
News_time Text Update time
News_delete Logic Delete Flag
This table is built according to the above requirements, and when we are tested and stabilized, we can transfer the news database to SQL Server.
Out. Well, take this step down, we'll do a news management page, for layout and management convenience, we use
The frame structure makes the following surface pages. Webadmin.htm the main file for the framework.
"HTML"
"Head"
"Meta http-equiv=" Content-type "content=" text/html; charset=gb2312 ""
"title" Press release System Management page "/title"
Meta name= "generator" content= "Microsoft FrontPage 3.0"
"/head"
"Frameset framespacing=" 0 "rows=" *,14% "
"Frame name=" main "target=" footnotes "src=" webadmin.asp "scrolling=" Auto "
"Frame name=" footnotes "src=" delete.asp "scrolling=" Auto "
"Noframes"
"Body"
"P" This page uses frames, but your browser doesn ' t support them. '/P '
"/body"
"/noframes"
"/frameset"
"/html"
And the face contains the file is webadmin.asp this file. Mainly by it provides input news daily update interface, the code is as follows.
"HTML"
"Head"
"Meta http-equiv=" Content-type "content=" text/html; charset=gb2312 ""
"Style type=" Text/css "
《!--
. lh22px {font-size:12px;line-height:22px;font-family: Song body}
a {Text-decoration:none}
Body {line-height:18px;font-size:9pt;font-family: XXFarEastFont-Arial}
TD {Line-height:18px;font-size:9pt;font-family: Song body}
a:hover {color: #FF0000; Text-decoration:none}
--》
"/style"
"Base target=" Footnotes "
"title" Press release System Management page "/title"
"/head"
"Body topmargin=" 8 "leftmargin=" 8 "
"P align=" center "" Font face= "italics _gb2312" size= "6" color= "#FF0000" "strong" press release system Web Management page "/strong" "/font" "P"
"Div align=" Center "center"
"Table border=" 0 "width=" 100% "cellspacing=" 0 "cellpadding=" 0 "
"TR"
"TD Width=" 100% "" Form method= "POST" action= "addnew.asp"
"Table border=" 0 "width=" 100% "height=" 126 "cellpadding=" 0 "
"TR"
TD width= "100%" height= "9" colspan= "2" bgcolor= "#E7E7E7" "Div align=" Center "" Center "" p "" Font
Size= "3" "strong" add Daily news content "/strong" "/font" "/td"
"/TR"
TR align= "Center"
"TD width=" 15% "height=" 8 "bgcolor=" #E7E7E7 "" div align= "left" "P" News title: (Must) "/td"
"TD width=" 85% "height=" 8 "bgcolor=" #F9F9F9 "" div align= "left" "p" "Input type=" text "
Name= "title" size= "73" "/td"
"/TR"
TR align= "Center"
"TD width=" 15% "height=" bgcolor= "#E7E7E7" valign= "Top" "div align=" left "" p "news content: (MUST)"/td "
"TD width=" 85% "height=" bgcolor= "#F9F9F9" "div align=" left "" P "" TextArea rows= "" 13 "
Name= "com