Page 200 Saturday, December 8, 2001 1:27 PM in Microsoft Office Print QR Code ISO/IEC18004 in Microsoft Office Page 200 Saturday, December 8, 2001 1:27 PM Page 200 Saturday, December 8, 2001 1:27 PM generate, create qr code none in microsoft office projects .NET Framework 3.5 Introduction to the Common Microsoft Office qr barcode Gateway Interface (CGI). 6 . Server-side scripting langu Microsoft Office Denso QR Bar Code ages have a wider range of programmatic capabilities than their client-side equivalents. For example, server-side scripts can access the server s file directory structure, whereas client-side scripts cannot access the client s file directory structure. Server-side scripts also have access to server-side software that extends server functionality.

These pieces of software are called COM components for Microsoft Web servers and modules for Apache Web servers. Components and modules range from programming language support to counting the number of times a Web page has been visited (known as the number of hits). Software Engineering Observation 6.

1. Server-side scripts are not visible to the client; only the content the server delivers is visible to the client.. As long as a file on the se qr codes for None rver remains unchanged, its associated URL will display the same content in clients browsers each time the file is accessed. For the content in the file to change (e.g.

, to include new links or the latest company news), someone must alter the file manually (probably with a text editor or Web-page design software) then load the changed file back onto the server. Manually changing Web pages is not feasible for those who want to create interesting and dynamic Web pages. For example, if you want your Web page always to display the current date or weather, the page would require continuous updating.

The examples in this chapter rely heavily upon XHTML and Cascading Style Sheets (CSS). CSS allows document authors to specify the presentation of elements on a Web page (spacing, margins, etc.) separately from the structure of the document (section headers, body text, links, etc.

). Readers not familiar with these technologies will want to read Appendix I and Appendix J, which describe XHTML in detail and Appendix K, Cascading Style Sheets, which introduces CSS. Figure 6.

3 illustrates the full program listing for our first CGI script. Line 1. #!c:\Python\python.exe is a directive (sometimes c Microsoft Office QRCode alled the pound-bang or sh-bang) that specifies the location of the Python interpreter on the server. This directive must be the first line in a CGI script. The examples in this chapter are for Window users.

For UNIX or Linux-based machines, the directive typically is one of the following:. #!/usr/bin/python #!/usr/local/bin/python #!/usr/bin/env python depending on the location o Microsoft Office qr barcode f the Python interpreter. [Note: If you do not know where the Python interpreter resides, contact the server administrator.] Common Programming Error 6.

1. Forgetting to put the direc tive (#!) in the first line of a CGI script is an error if the Web server running the script does not understand the .py filename extension..

Line 5 imports module time. QR Code for None This module obtains the current time on the Web server and displays it in the user s browser. Lines 7 17 define function printHeader.

This function takes argument title, which corresponds to the title of the Web page. Line. Page 201 Saturday, December 8, 2001 1:27 PM 6 . Introduction to the Common Gateway Interface (CGI). 1 2 3 4 5 6 7 8 9 10 11 12 Microsoft Office qr-codes 13 14 15 16 17 18 19 20 21. #!c:\Python\python.exe # Fi g. 6.

3: # Displays current date and time in Web browser. import time def printHeader( title ): print """Content-type: text/html < xml version = "1.

0" encoding = "UTF-8" > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns = "http://www."> <head><title>%s</title></head> <body>""" % title printHeader( "Current date and time" ) print time.ctime( time.

time() ) print "</body></html>". Fig. 6.3 CGI script displaying the date and time. 8 prints the HTTP header. N qr barcode for None otice that line 9 is blank, which denotes the end of the HTTP headers. The line that follows the last HTTP header must be a blank line, otherwise Web browsers cannot render the content properly.

Lines 10 14 print the XML declaration, document type declaration and opening <html> tag. For more information on XML, see 15. Lines 15 17 contain the XHTML document header and title and begin the XHTML document body.

Common Programming Error 6.2.
Copyright © . All rights reserved.