How to start an ASP website design

Source: Internet
Author: User
Tags date empty end functions connect access database administrator password access
Design how to start an ASP website design
Give this article to Bluetooth, also as a reference for beginners. The article is only about my personal views and practices, if there is no place, please correct me.
In the beginning of the design of an ASP site, faced with a lot of problems, in the end to how to start to make the site design fast, good, and debugging, change, transplant and convenient? Following the design of the message book as an example, talk about the design of the site.
(i) the function of the site
"Maito", first write the function of the site, for the future work has a lot of help. Now to design a message book, the function is as follows:
1, single user version. Only one administrator, everyone can leave a message, you can search the message
2, record the ip,qq of each message, avatar, name, homepage, email, message time, message content;
3, have the administrator reply function. If you have already replied, you can also change the contents of the reply. Record the time of reply;
4, record the location of the homepage, in order to quickly return to the home page.
5, custom headers and footers. Displays the specific information.
6. Save data to an Access database
7, management functions: admin login/reply/delete/change admin password/change the number of messages displayed/change the home page
(ii) Site database
General ASP site to use the database, the first design database, in use will not be for a field to query or change the design of the database. Especially for large Web sites, good database design can affect the entire site's operation. Now let's design the database of the message book:
1, database name: Lyb.mdb
2, table: A total of two tables
Table One: admin
Field Name Type length other description
Admin_user Text 15 does not allow null values/primary key Admin user name
Admin_pass Text 15 does not allow null value Administrator password
Admin_http text 50 can be null value home address
Admin_perpage digit/integer decimal is 0

Table II: Main
Field Name Type length other description
USER_ID Automatic Numbering
User_name Text 15 is not a blank name
User_image Text 30 is not an empty avatar file name
User_ip Text 15 is not an empty IP address
User_oicq text 10 can be empty QQ number
User_http text 50 can be empty home page
User_email text 50 can be empty e-mail
User_time Date Long Date message time
User_ly text 255 not empty message content
User_replay Yes/no reply
User_rply text 255 can be null reply content
User_rptime Date Long Date reply time

Message the database is relatively simple, if it is a large site, in the database design after repeated inspection. All field names are best to use the naming standard, after the database design is completed, it is best to print out a list like the above to facilitate the use.

(iii) document design of the site
The design of a file is primarily about how many files are designed, what each file contains, and how it is related. Take the message as an example, the document is designed as follows:
1, inc.asp related functions and constants, including open database functions, open Table functions, word processing functions
2, top.htm page header information
3, bottom.htm footer information
4, index.asp Guestbook this homepage. including display message, admin login, modify parameters, reply message. Quoting inc.asp;
5, main.css css file;
6, tou.htm avatar list file;
7, image folder, save Avatar and other pictures;

(iv) page design of the site
Page design is mainly designed to design the style and layout of the page. This part of the content is more, usually first positioning the entire page style, and then design all the illustrations and Flash, and then design CSS, and finally design each page. For pages with duplicate content, first design a single content. The general design of Index.asp is listed here as follows:
' Reference inc.asp
<%
' Processing parameters
' Message subroutine
' Login subroutine
' Reply subroutine
' Remove sub-program
' Modify the Parameter subroutine
' Exit Login subroutine
%>
<!-Reference css-!>
<title> Message Book </title>
<body>
' Reference top.htm
' Show the Message form
' Show Search Form
' Show Message Records
' Reference bottom.htm
</body>

Of course, in the page design phase, and do not write subroutines, as long as the display of the various parts of the line to do
(v) station page code design
The main is to complete the design of ASP code. Here just talk about how to make the site modifiable and portable to strengthen. There is only one point: multiple components or functions, of course, if you write the class is better. For small sites, do not want to go to each page of a subroutine to use set Conn=server.createobject ("Adodb.connection"), but to write it as a function or subroutine, placed in the page, such as:
<%
Databasename= "Lyb.mdb"
Uid= ""
Pid= ""
Sub Opendb (Connect)
Set Connect=server. CreateObject ("Adodb.connection")
Connect. connectionstring= "Driver={microsoft Access DRIVER (*.mdb)}; Dbq= "&_
Server. MapPath (databasename) & "uid=" &uid& ";p id=" &pid
Connect. Open strconn
End Sub
%>

In this way, when you change the database name or username and password, it is convenient to change. After a period of accumulation, you will have a lot of such functions or subroutines, or classes, and then do similar sites, as long as the relevant to put in a file in a reference to the good.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.