Table of Contents
 Home
 About this Tutor
 Introduction
 HTML Editors
 Basic Code
 Utter Basics
 The Body Tag
 Headings
 The Font Tag
 Images
 Tables
 Tables Part Two
 Tables Part Three
 Nesting Commands
 Some Design Tips
 Meta Tags
 Web Hosts
 Uploading Your Site
 Copyright Issues
 HTML Mail Lists
 Future of HTML
 Marketing
 Style Sheets
 CSS and Text
 CSS and Fonts
 CSS and Cursors
 CSS and Backgrounds
 CGI
 CGI Scripts
 JavaScripts
 Affiliate Programs List
 Browsers
 Dang 404 Errors
 Color Chart One
 Color Safe Chart
 Color Chart Three
 Code Chart
 Arial Character Map
 Times Character Map
 Wing Ding Character Map

 Meta Tag Generator
 BBS Forum
 Contact Us
 Glossary
 SiteMap
This Site Has Been Rated:
Rating = 7.69By 180 Users
Please Vote Here:

Counters

There are many, many counters available. Some use graphics to create very "showy" counters. This one is very basic, it simply uses whatever font you tell it to use and prints out the number of hits to date. I like this one because of it's sheer simplicity. I put it at the bottom of almost all my pages.

The use of a counter on your pages gives you an instant way to see how many visitors you are getting. I check the counters weekly and keep a record. This helps me to see how many visitors I'm getting on all my sites, across all of my domains.

The first one uses a line that makes the counter create a count file that is the page name of whatever page you put it into. That is pretty kewel. Here it is:


#!/usr/bin/perl

print "Content-type: text/html\n\n";
($PAGE = $ENV{'DOCUMENT_URI'}) =~ s/\//_/g;
if (!(-e $PAGE)){open(NEW,"> $PAGE");print NEW "0";close(NEW);exit(0); }
open(COUNTER,"+< $PAGE");
flock(COUNTER,2);
$_=;
seek(COUNTER,0,0);
$_++;  print;  print COUNTER;
flock(COUNTER,8);
close(COUNTER);

This one will (in this particular case) create a counter log file named countername. You can see where that is defined within the code. Change countername to anything you want. This is the same exact counter as above, only the one line has changed to where you can name what you want the counter log file to be. For whatever reason, I use this version all the time. I create a new counter.cgi file for each of my pages. For instance, if the page I'm working on is called pagetwo.shtml I would name this counter pagetwo.cgi and I'd change the line:

($PAGE = pagetwo);


#!/usr/local/bin/perl

print "Content-type: text/html\n\n";
($PAGE = countername);
if (!(-e $PAGE)){open(NEW,"> $PAGE");print NEW "0";close(NEW);exit(0); }
open(COUNTER,"+< $PAGE");
flock(COUNTER,2);
$_=;
seek(COUNTER,0,0);
$_++;  print;  print COUNTER;
flock(COUNTER,8);
close(COUNTER);

Here is another script for you to use. It's a footer, header, whatever inclusion script. Everytime that you call it out, everything in the file footer.txt displays on the screen. This is very useful. You can change the filename, and the part inside the script that says footer.txt to something else, like, header or whatever you like. It can be anything that you include on numerous pages and want to simplify. The best part is when it comes time to update that text, you do it in one file only. Quick and easy.


#!/usr/bin/perl

$content = "footer.txt";

print "Content-type: text/html\n\n";

open(FILE,"$content");
while($content = ) {
        print $content;
}
close(FILE);

The $content line needs to be changed to whatever file you use. You can modify this script by changing that to header.txt and renaming the file itself to head.cgi. You can use it for a navigation panel, like the one at the left, that you use on every page. Updates become very easy as you only need to update the one file. Use it for anything you like, just change that $content line and the filename itself.

Here is some sample copy for the footer.txt file


© Copyright 2004 HTMLGuide.US All Rights Reserved No Part of this Site May be Reproduced in Any Form or Any Media Without Prior Written Permission.

This script is a Server Side Include also referred to as SSI. Today there are other ways to include text from an auxiliary file into your HTML document, but this still work, and is very good. To use these SSI scripts you need to tell the server and the browser that there is a need for SSI. That is done by changing your file extension from .htm or .shtml to .shtml. There is also a way to set-up your server so you don't have to do that, but it is beyond the scope of this basic tutorial.

Well, we've pretty much covered all the basics, for this Basic HTML Tutorial. There is more to learn, for sure, but the best thing to do is get going writing pages. That alone will bring you more knowledge, and ready you to learn more. There are also more tutorials around that get into programming and more advanced parts of web design and construction. Stick with it. It's a blast. I feel at home running web sites. I hope you will find yourself at home writing them too.


< >



Daily SEO Tips eMail
SEO Blog
SEO Training
SEO Basics 101 eBook
Learn All the Basics to SEO





© Copyright Night Train Web Productions Night Train Web Productions — All Rights Reserved
No Part of This Work May be Reproduced by any Means Without Prior Written Authorization
8153 / 051006 / 301788