A simple way to generate static pages

Source: Internet
Author: User
Tags header include split
Recently found a simple way, more suitable for beginners, do not dare to enjoy, take out to share with you.

The central idea is to invoke the dynamic template (i.e. you do the ASP page). In this way, almost all ASP pages can be turned into HTM pages, so as to achieve the dream of generating static pages.

Example:
<textarea name= "A" cols= "a" rows= "6" id= "a" ><!--#include file= "index.asp"--></textarea>

In the ASP page directly displayed in the form of the text bar, easy to modify. Note: The index.asp code in your text bar has become a static page code composed of normal HTM. The submission form is then uploaded to the database.

Then the step is: the index.asp static page of the database, using the FSO, such as writing HTM file, save.

If it is a news release, it is recommended to generate STHML files, that is, Sina with the kind, on the map it can execute include statements, is really a boundless I swim ah, extrapolate, detailed description.

Set up the header field in the database, left, right, bottom (if you can add the ID field of cow x, then do a few more sets of templates love to generate what kind of model.) , these few fields must be text type, because the more installed (even Sina's homepage more than a few pieces are enough.) )

Do the normal ASP page (note: When you do ASP page should head, left, right, under all do, because we call is a one called.) , above is the head, the left is the news content, the right is the news list, below is the bottom, casually makes an HTML template. (Won't do to see the last side)

At last:
Replace Dafa with replacement.

For example, to the head, to replace the template code into the database read out of the header field stored in the code, and so on, and finally put all the extracted code into the HTM file.

Friendly Tips Sample code:
Set rs = Conn.execute ("SELECT * from HTML")
Head = RS (' head ')
left = RS (' left ')
right = RS (' right ')
foot = RS ("foot")
Rs.close
Set rs = Nothing
HTML = Head&left&right&foot
No test, anyway that's what it means.


Of course, you cannot generate only one, you need to generate multiple, we can take this process as a function, and then:
Set rs = Server.CreateObject ("Adodb.recordset")
sql = "SELECT * from HTML"
Rs.Open sql,conn,1,1
Do as not rs.eof
Call generation Process function
Rs.movenext
Loop
Rs.close
Set rs = Nothing


Write here to forget one of the most important things, faint death, stumbled don't know what to write. Forgot to add the article information, Khan ... , but I think we all know how to add the information. I'll just say the nonsense.


SORRY, I haven't finished yet.


About the HTM template:

<meta name= "keywords" content= "$keywords $"/>
<meta name= "description" content= "$description $"/>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title> $title $</title>
<style type= "Text/css" >
<!--
Body {
margin-left:0px;
margin-top:0px;
}
body,td,th {
Font-family: Song body;
font-size:12px;
Color: #666666;
}
. newtitle {
font-size:14px;
Font-weight:bold;
}
-->
</style>
<body>
<table width= "980" border= "0" align= "center" cellpadding= "0" cellspacing= "0" style= "border: #CCCCCC; border-width:1px; Border-style:solid ">
<tr>
&LT;TD colspan= "2" > $head $</td>
</tr>
</table>
<table height= "5" ><tr><td></td></tr></table>
<table width= "980" border= "0" align= "center" cellpadding= "0" cellspacing= "0" >
<tr>
&LT;TD width= "69%" align= "left" valign= "top" ><table width= "100%" border= "0" cellspacing= "0" cellpadding= "0" style= "border: #CCCCCC; border-width:1px; Border-style:solid ">
<tr>
&LT;TD height= align= "center" ><span class= "Newtitle" > $newtitle $</span></td>
</tr>
<tr>
<td><table width= "98%" border= "0" align= "center" cellpadding= "0" cellspacing= "0" >
<tr>
<td> $content $ </td>
</tr>
</table></td>
</tr>
<tr>
&LT;TD height= > Release time: $newother $</td>
</tr>
</table>
<table height= "5" ><tr><td></td></tr></table>
</td>
&LT;TD width= "1%" rowspan= "2" align= "left" valign= "Top" > </td>
&LT;TD width= "30%" rowspan= "2" align= "left" valign= "top" ><table width= "100%" border= "0" cellspacing= "0" cellpadding= "0" style= "border: #CCCCCC; border-width:1px; Border-style:solid ">
<tr>
&LT;TD align= "left" valign= "top" > $other $</td>
</tr>
</table></td>
</tr>
<tr>
&LT;TD align= "left" valign= "Top" >
<table width= "100%" border= "0" cellspacing= "0" cellpadding= "0" style= "border: #CCCCCC; border-width:1px; Border-style:solid ">
<tr>
&LT;TD height= > news Source: $about $</td>
</tr>
</table>
</td>
</tr>
<tr>
&LT;TD colspan= "3" > </td>
</tr>
</table>
<table height= "5" ><tr><td></td></tr></table>
<tbody>
<table width= "980" border= "0" align= "center" cellpadding= "0" cellspacing= "0" style= "border: #CCCCCC; border-width:1px; Border-style:solid ">
<tr>
&LT;TD colspan= "2" > $foot $</td>
</tr>
</table>
</tbody>
</body>

In fact, do not use the $ symbol does not matter, the problem of the symbol is very auspicious.


SORRY, there are:

Problems that can occur when you build a page:

If you have JavaScript in your Web page, there must be "'" (single quotes). This symbolic SQL has a grudge against him, so we'd better replace it with the substitution Dafa, replacing it with characters such as "blue-blue-blue" or "color-color", which are not easy to repeat, At the time of generation, replace him.

Although the text field is loaded many but also has the limit, therefore is enough, the attire too many certainly cannot save.

Generation is best not to generate all, I think most of the site is a generation of more than 10 or dozens of pages, so it is best to add the form page and then let the administrator select the news to generate, and then split the split function needs to generate a mesh ID.


Click on the question: I told you before. Generate STHML file it cannot contain. asp files that can only be used with IFRAME, but may be included. HTM, said here all understand it, generate HTM a bit not complex.


Finally say this method to generate a relatively low rate, but certainly is the most suitable for beginners, we rent in the space to do not try, to generate the best in the local generation and then package upload into space.



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.