APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed
RSS Feeds RSS Feeds











(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version
->
-> The AutoMagic Web Site


The AutoMagic Web Site




When I first started writing web pages, they were always static pages: straight HTML. If there was any CGI at all, it was only to handle forms. No doubt every beginning web master starts out that way, and if your web site never grows beyond a handful of pages, that's probably fine. However, as your site grows in complexity, static pages become burdensome and quite annoying to maintain.

One aside before we dive in completely: there is a technical difference between dynamic pages and generated pages that the rest of this article is going to generally ignore. A dynamic page has imbedded code (Javascript, Server Side Includes, or whatever) or may be generated completely from a CGI script. A generated page can be just static HTML as it sits on the server, but that HTML very well could have been created by a script or other program (and of course nothing prevents such a page from also including dynamic content). What sort of scheme you use to produce pages varies with your needs and preference; I use all methods myself and you probably will too.

For example, let's look at the various things that need to happen when I add a page to my site:

  • First, it needs to appear in at least two index pages. This article belongs in the general Unix Articles index, the Sitemap index, and in the Unix Programs index (because it contains code).
  • Within the main Unix Articles index, any article may need to appear in more than one place. This article will appear under Programming, Code, Web/HTML and Perl.
  • Every article has links to every "related" article, book review or link. If those had to be updated manually every time a new page is added, that alone would be long, tedious and error-prone (there are more than 200 separate articles at my site as I write this, and of course more are added every month).
  • Every new article has to be added to the proper place in What's New?.
  • The search engine uses index files that need to have information about this new article added in.
  • Each article displays site index navigation links at the top. Of course, I change that from time to time, and again I don't want to have to update every article.
  • Similarly, each article contains a copyright notice that I may want to adjust, and each article contains style sheet information that determines font sizes, etc. I wouldn't want to have to go through every single article because I decided that the color of my <H2> tags should change!


All of this is handled by Perl scripts. The generation of the style sheet classes and the copyright notice is just simple SSI (Server Side Includes): a line in each file has this, for example:


<!--#include virtual="/cgi-bin/copyright.pl" -->

As you may already know, such a line (on a server that supports SSI) will cause the displayed web page to have the text generated by the script that it calls. The "copyright.pl" generates the boilerplate copyright, and a similar line generates the style sheets.

The rest of it all happens because one line that describes the article is added to a data file that a number of other programs read. That data file looks like this:

ARTICLES:/Unixart/linppp.html:Red Hat Linux as a PPP Server:January 1999:Tony Lawrence:Linux|Networking
ARTICLES:/Opinion/java.html:Java? :January 1999:Tony Lawrence:Opinion
ARTICLES:/Reviews/wt5.1.html:Winterm 5000 Terminal:January 1999:Tony Lawrence:Reviews|Modems/Terminals|Networking
ARTICLES:/Reviews/proxyserv.html:Review of Netscape Proxy Server:February 1999:Tony Lawrence:Reviews|Security|Networking

...

ARTICLES:/Unixart/linkfail.html:Kernel Link Failures:September 2000:Tony Lawrence:Installation|Kernel/Internals
ARTICLES:/Reviews/logmon.html:Logmon Inactivity Reporter:September 2000:Tony Lawrence:Reviews
ARTICLES:/Opinion/technofable.html:Technofable- James Richardson:September 2000:James Richardson:Opinion
ARTICLES:/Linux/linrh70.html:Red Hat 7:October 2000:Tony Lawrence:Linux|Reviews
ARTICLES:/Unixart/vdom_eng.html:Mail in a Virtual Domain:October 2000:Roberto Zini:Mail|Installation
 

Every index page gets information from this file by way of a Perl script. Additionally, every page shows pages related to itself by another script that also reads this file.




If this page was useful to you, please help others find it:  





3 comments




More Articles by - Find me on Google+



Click here to add your comments
- no registration needed!




Thu Jul 6 14:18:25 2006: 2218   TonyLawrence

gravatar
A lot of this has changed. Nowadays, almost all pages here call a script that reads the real content from a database. This lets me have one script that I can modify to add or delete features and change presentation.







Wed Jul 7 20:25:07 2010: 8798   TonyLawrence

gravatar


And even more recently, it has all been converted back to static. Perl scripts read all the databases to generate the pages, but I had to go to static because of increased traffic.



Wed Jul 7 20:26:46 2010: 8799   TonyLawrence

gravatar


See http://aplawrence.com/Unixart/loveperl.html for why I use Perl rather than more structured languages.

Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar

Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

I am a Kerio reseller. Articles here related to Kerio products reflect my honest opinion, but I do have an obvious interest in selling those products also.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.

pavatar.jpg

This post tagged:

       - Code
       - Perl
       - Programming
       - SEO
       - Web/HTML















My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!


book graphic unix and linux troubleshooting guide



Buy Kerio from a dealer
who knows tech:
I sell and support

Kerio Connect Mail server, Control, Workspace and Operator licenses and subscription renewals



Click and enter your name and phone number to call me about Kerio® products right now (Flash required)