BW: Boltwire Projects > TNET Created Boltwire Plugins > Pagecount

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:


VariablesDescription
{pgcount}
Page count
{pgpage}
Page that was counted
{pgcountfile}
Full path to the countfile
{pgerror}
Output of errors and debugging

Installation

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).

$counterdir =  $_SERVER['DOCUMENT_ROOT'] . "/field/counters/";

Example Use

[{pagecounter}]

Access# {pgcount}

Alternative Method

Using Boltwire without the plugin you could basically do the same thing. Info provided by Dan.

Page viewed [(info counter field={p} target=info.pagecount)] times...

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

Main Sections:

Other TNET Sites:


Contents © 2010 TNET Services, Inc. - All rights reserved.
You are a member of the guest groups
Page Creation by TNET using Boltwire v3.4.11 Hosting by TNET - Server Temps (189F/167F/104.4F)
IP: 38.107.191.100 [No rDNS] - Views #10