| YOU ARE HERE: HOME > WEB DESIGN ESSAYS > CGI PERL AND SERVER SIDE INCLUDES |
Does this describe you... Well stop right there! You can easily make this the last year that you're faced with the tedious task of repeatedly changing the exact same text on each page of your site. By incorporating the use of CGI Perl scripts and Server Side Includes (SSI) into your web pages, you can make one change in one place, and the result will be that every page of your site gets changed. Perl, which stands for "Practical Extraction and Report Language", is a program scripting language that can be run by a web server via Common Gateway Interface (CGI). SSI allows us to embed special directives in our HTML documents that execute other programs or insert various pieces of text. When these two are used together, the result is a powerful tool that allows for dynamic content. Why Perl
A Real Life Example Below is the HTML for the sample web page and the code for the Perl script. The HTML
The Perl Script
I've placed the above sample web page on my server so you can view it and see the resulting source code. It's at copyright.shtml. (Please note that this page has an 'shtml' suffix instead of the usual 'htm' or 'html'. The 'shtml' suffix is required by many webhosts and tells the server to parse this web page for SSI calls). When you view the source, you'll notice that the SSI command (#exec cgi...) has been replaced with the copyright information from the Perl script. The beauty of this approach is that I can now insert the SSI command on every page of my website where I would like to display copyright information. When I need to change my copyright year, all I have to do is change the Perl script, and voila, every page that invokes the script is automatically changed. A Final Note And, as usual, if you feel we can help you with any of the above, feel free to contact us with your questions or requests. |