A hit counter for formbrowser?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
sam_m
Forum Members
Forum Members
Posts: 34
Joined: Thu Jun 11, 2009 11:59 pm

A hit counter for formbrowser?

Post by sam_m »

Hello,

I have an online petition created using formbuilder and formbrowser which works a treat. I just wondered if it`s possible to have a little counter at the top of the page which will tell me how many petitions have been posted on the website?

Any thoughts would be greatly apreciated
Kind Regards
Sam
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: A hit counter for formbrowser?

Post by Rolf »

Hello sam_m

Create an UDT called read_entries

Code: Select all

// Maximum excepted entries
$entries_max = ($params[max]);

// Read entries in FormBrowser
global $gCms;
$list = $gCms->smarty->get_template_vars('list');
$entries = count($list);

// Complex Mathematical Calculation :o)
$entries_left = $entries_max - $entries;

// Passing the parameters to the template
$smarty = &$gCms->GetSmarty();
$smarty->assign('entries_max', $entries_max);
$smarty->assign('entries', $entries);
$smarty->assign('entries_left', $entries_left);
You can call this udt in a page like:

Code: Select all

{cms_module module='FormBrowser' browser='your-name'}
{read_entries max='10'}
You can use the parameter max if you want to limit the entries. You probably don't need this.

In a template or page you can use these strings:
{$entries} = Total entries in the database
{$entries_left} = Allowed entries left
{$entries_max} = Maximum entries allowed.

Hope this helps,

Rolf  :)
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
sam_m
Forum Members
Forum Members
Posts: 34
Joined: Thu Jun 11, 2009 11:59 pm

Re: A hit counter for formbrowser?

Post by sam_m »

Thank you Rolf,

Greatly appreciated :) will give it ago now
Post Reply

Return to “Modules/Add-Ons”