ASP 3.0 Advanced Programming (12)

Source: Internet
Author: User
Examples of 4.2.3 server-side include directives
This section provides sample pages that you can use to experiment with a variety of server-side include statements. Opens the subdirectory Chapter04 for the sample Web page, displaying the SSI directives and the ASP Server Object home page (that is, default.asp in the subdirectory Chapter04), as shown in Figure 4-3:
Figure 4-3 Example Web page
All of the examples in this book can be downloaded from our web site. Readers will find all the sample pages in the remainder of this chapter in the subdirectory Chapter04 of the sample.
1. Using ssi/cgi processing instructions
Click the link to enter the Server-side Include and CGI statements page, which opens the Ssi_cgi.stm page. Note that the file name extension for this page is. stm, which indicates that this is not an ASP Web page. The page uses all of the SSI directives that were previously discussed except for the #exec directive (see later), and shows how and how the instructions are used, as shown in Figure 4-4:
Figure 4-4 the ssi/cgi processing instructions shown on the sample Web page
(1) #include指令
The beginning of the page, "Include Files with SSI", displays the contents of another separate file named Intro.inc. The following is the entire contents of the file:
Note that we must use the HTML entry "<" and ">" to display the angle brackets in the Web page. If this is not done, they cannot be treated as part of the annotation element and cause the instructions in them to be executed.
In the main ssi_cgi.stm page, the code to insert this file into the page is simple:
<!--#include file= "Intro.inc"-->
(2) #config, #fsize和 #flastmod instructions
The next section of the page shows the size of the file default.asp and the last modified time in the same directory as the page. #config instructions are used three times here:
· One time is to set the SSI error message.
· One time is to format the date and time.
· The format of the file size calculation is set once.
Insert values into the Web page using the #fsize and #fiastmod directives:
<p><div class= "subhead" >ssi statements</div>
<!--#config errmsg= "SSI processing Error"--> &nbsp;
(sets error message in case of SSI error) <BR>
<!--#config errmsg= "SSI processing Error"--><p>
Details of file ' Default.asp ':<br>
<!--#config sizefmt= "BYTES"--> &nbsp;
(Sets Fsize to return size in bytes) <BR>
<!--#config sizefmt= "BYTES"-->
<!--#fsize file= "Default.asp"-->
Returns: &nbsp; <B><!--#fsize file= "Default.asp"--> bytes</b><br>
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.