![]() |
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
To access the contents, click the chapter and section titles.
Perl CGl Programming: No experience required.
Getting around HTMLThe quick and dirty way around this limitation would be to change the name of your Web site from, say, www.MySite.com to www.MySite.com/scripts/access.pl. Thats ugly. You dont want to do that. Some Webmasters point their site URLs to an HTML document that is just a facing page, which puts up a Welcome! message and advises the visitor to click on a hyperlink to enter the site. Figure 4.6 is an example of a facing page. The Click here to enter! message is the hyperlink.
The hyperlink is a URL to a Perl script that runs the access counter and also draws the entire home page. This is not a bad solution, though it requires a somewhat inelegant extra step. Sadly, the only other solutions are based on proprietary extensions to HTML or equally proprietary graphics packages. This is such a perplexing problem that a small industry has sprung up around ityou can actually rent space on Web sites that do nothing more than keep track of your visitors and draw the count on your home page! You will learn about some of the HTML extensions and a graphics package that can do the job in Skill 8. However, one extension, frames, is interesting enough to discuss here. Using Frames to Automate a URLA few versions back, Netscape developers came up with the idea of including frames in the HTML that their Navigator browser would understand. This gave the browser, and the HTML developer writing Web pages for Navigator, the ability to break a Web page up into different windows, each operating independently of the others. At the time, it only worked with Netscapes software, which is why you still see a lot of Web pages that give you a choice between frame-capable displays and regular HTML. Microsoft included the ability to recognize and deal with frames in its Internet Explorer browser, so the two most popular Web packages on the market today will do frames. As a result, it is not absolutely imperative to make provisions for frame-damaged browsers any more, which definitely was not the case even a couple of years ago. These days, the chances are extremely good that you can depend on your visitors having the capability to display frames. Figure 4.7 illustrates a home page constructed with frames.
Interestingly, Figure 4.7 also illustrates a home page with a built-in access counter. Its creator used a feature of the frame extensions that Netscape tacked on to HTML. On a frame-capable Web site, you generally make the home-page HTML document the one that sets up the frames. It then calls in the actual HTML documents that comprise the home page. The beauty of this setup, for our purposes, is that each frame declaration needs to know what HTML document it should call in, but the declaration effectively is in the form of a URL. The result is that you can put any valid URL in a frame declaration, including the path to a Perl script that will generate a number showing the hits on the Web site and draw the home page for you. Figure 4.8 shows the HTML document that draws the page in Figure 4.7. Notice that the source for the frame named Main, which is the window on the right in Figure 4.7, is a URL pointing to access.pl. The remaining information is a list of arguments to access.pl. It specifies the HTML document to draw as the home page and the location of the file in which the access count is stored.
Moving On HTML forms are the most heavily used interactive construct on the World Wide Web. In the next skill, youll learn how to gather and process information sent to you through CGI from a form. Are You Experienced?Now you can
|
![]() |
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. |