Pagecount Plug-in for Boltwire
Description:
Primarily written as a sample plugin, this provides a way to have page counters for each page as they are accessed.
It uses a counters directory to store the page files which represent the pages being counted and contains the actual page counts.
Download
Available from the Boltwire site in the Extensions section
Usage
As a page is accessed, the function looks for that page count file, creates it if it doesn't exist and then increments the counter.
It then sets 4 system vars called:
| Variables | Description |
|---|---|
{pgcount} | Page count |
{pgpage} | Page that was counted |
{pgcountfile} | Full path to the countfile |
{pgerror} | Output of errors and debugging |
Installation
- Download the PHP script and place in your home/plugin directory.
Make sure you create a counter directory. One place to do that would be in your field directory as counters. It needs to have write access by your server (typically chmod 0777).
- Edit the script so that it knows where the counter directory is.
- Activate the plugin.
Example Use
- Place the following in your top zone:
- Place the following somewhere on your pages, perhaps in your bottom zone like:
Alternative Method
Using Boltwire without the plugin you could basically do the same thing. Info provided by Dan.
- Put in footer or somewhere:
It stores all your data in one page: info.pagecount, using the page name as a key, and the "counter" info command simply increments that info value by one. (BTW info commands are extensible as well...). This gives you a lot of real nice capabilities.
For example:
{info.pagecount::{p}} | Gives current page count. Change {p} to other page... |
[(info count group=forum* target=info.pagecount)] | Give total number of pages viewed in forum group |
[(info sum target=info.pagecount sort={+value} count=20)] | Combined page views of 20 most popular pages. |
[(info report target=info.pagecount sort={+value} count=20 template="[[{+field}]]: {+value}")] | A report of 20 most popular pages& count |


