[phorm] [Phorm:] Counter Plugin

  • From: webbbs@xxxxxxxxx
  • To: support@xxxxxxxxx
  • Date: 29 Jul 2003 01:45:27 -0000

The following new message has been posted on Phorm Support Forum at 
<http://www.phorm.com/support/>. 

*************************************************************************** 

  MESSAGE:  (#3065) Counter Plugin 
            <http://www.phorm.com/support/?rev=3065> 
  AUTHOR:   Patrick O'Hara 
  DATE:     July 28, 2003 at 9:45 p.m. EST 

Hi everyone, 

This thread has been provoked by someone asking about the behaviour of the 
counter plugin - so it seems an opportune time to explain in detail. The first 
part of this is taken straight from the documentation supplied with the 
counter. The remainder of the thread simply clarifies a couple of things about 
the counter that may not be obvious at first. 

Patrick O'Hara 
WhitsundayIT 
QLD, Australia 

patrick@xxxxxxxxxxxxxxxx 
www.whitsundayit.com 

Counter Plugin 

The purpose of this module is to generate an incremented number each time a 
form is successfully submitted. 

Installation 

To install this module, place the file counter.php in your plugins directory, 
and add the following line to the registry file registry.php: 

> valid counter.php 

If you want the counter to increment regardless of whether the form passes 
validation use this line instead of the above: 

< valid counter.php 

Use 

The module maintains the counter in a plain text file. You can specify the 
file to use with the variable $PHORM_CNTFILE. If you don't specify it, the 
module will look for a file named count.txt in the templates directory and use 
it if it exists. Using $PHORM_CNTFILE, you can specify the same counter for a 
number of forms if you wish. Phorm must have write access to the file. 

The count will be available in the variable $PHORM_COUNTER. 

That's all there is to it! 

Important Note 

If you don't specify $PHORM_CNTFILE, the counter plugin looks for a file named 
count.txt and uses it if it is found. This produces some interesting behaviour 
that you may or may not expect. 

If your count file is named "count.txt" then the plugin will find that file, 
open it and increment the counter regardless of whether you specified 
$PHORM_CNTFILE. 

If you use one installation of Phorm to manage several forms, and one uses the 
counter plugin and the other doesn't, you would expect that in the first one 
you'd define $PHORM_CNTFILE and in the other you wouldn't. BUT if the file is 
called "count.txt" then the counter will get incremented in both forms just 
that the second form wont do anything with the incremented value. 

(Incidentally - this was how I discovered this behaviour with my own setup, it 
was a little confusing for a while...) 

Solution... 

To get around this problem call the file something other than "count.txt". 

*************************************************************************** 

This is an automatically-generated notice.  If you'd like to be removed from 
the mailing list, please visit Phorm Support Forum at 
<http://www.phorm.com/support/>, or send your request to webbbs@xxxxxxxxxx  If 
you wish to respond to this message, please post your response directly to the 
board.  Thank you! 
-------------------------------------------------
You are receiving this message because you are subscribed to the Phorm mailing 
list. To send messages to the mailing list, simply send email to 
phorm@xxxxxxxxxxxxx from the address you have subscribed. You may unsubscribe 
from the list by sending email to phorm-request@xxxxxxxxxxxxx with 
'unsubscribe' in the SUBJECT field.

Other related posts:

  • » [phorm] [Phorm:] Counter Plugin