As its name implies, the Counter Library is provided to make it easy for you to place counters into your Web Pages. There are only three Tags in this library, but that's all you need to manage counters in your Web Pages.
< CounterCreate />
This Tag is normally used only once. Its purpose is to create an SQL Table called webcount, containing two fields: the counter name and the current value associated with that counter.
You can store any number of page counters in the webcount Table, so long as each Web Page specifies an unique counter name, as defined by the following Tag:
< Counter name="name" />
This Tag searches the SQL Table webcount that was created by the <CounterCreate> Tag. If the counter name specified by the name parameter above is found to exist in the webcount Table, then it is automatically incremented and the new value stored in webcount. If, however, the named counter is not found, the <Counter> Tag assumes this is a new counter, and it inserts it into webcount for you automatically.
Let's assume that you have already used the <CounterCreate> Tag to create the webcount SQL Table, and now you want to insert counters into each of your Web Pages. All you have to do is place the <Counter> Tag into the these Pages and choose an unique counter name. For example, if you have a Page called mainpage.hei. you could call the <Counter> Tag as follows:
To find out what value is currently associated with the mainpage counter, you need only put a statement somewhere in your Web Page like the following:
Of course, there's no rule that says you have to tell people how many times a page has been called, so if you want to simply use the webcount Table as a convenient place to keep track of the number of "hits" your pages are getting, and not print a message, then that's your privilege.
< CounterReset name="name" />
There may be times when you want to reset the value of your counter to zero. For instance, if you have a message in your Web Page that says:
then obviously, you need to have a way to reset the counter at the beginning of each month. Normally, the <CounterReset> Tag will be used in some special heitml Page you've created to perform maintenance tasks, and should not normally be included within the same Web Page that references the named counter.
You could, however, use this Tag in concert with other Tags found in the Date/Time Library to automatically perform this task for you. For example:
© 1996-2022 H.E.I. All Rights Reserved.