[BLOCK] Simple text...
 
Notifications
Clear all

[BLOCK] Simple text page counter

6 Posts
3 Users
0 Reactions
1,782 Views
(@wimvincken)
Posts: 44
Eminent Member
Topic starter
 

A block for a simple page counter.

http://forum.writingcenter4.info/index.php?action=mgallery;sa=item;id=11334

This page counter will count the number of hits per page. This counter is organized in a block, so that means that the hit counter is counting the hits for each page of the eFiction site.
When you install the block, you can get the page counter by including {pagecounter_title} and {pagecounter_content}

[Modified by Wim]
I listened, and here is the database version of the counter.
http://forum.writingcenter4.info/index.php?action=mgallery;sa=item;id=11402

And the code (if you don't want to download it):

<?php
if(!defined("_CHARSET")) exit( );
// Take care that you add a field (hits) in the 'fanfiction_stats' table
// Replace 'tblprefix' from the tablename with your own prefix
// ALTER TABLE `tblprefix_fanfiction_stats` ADD `hits` INT( 11 ) NOT NULL ;

// Get the hits counter
$stats = dbassoc(dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_stats WHERE sitekey = '".SITEKEY."' LIMIT 1"));

// Increase the hits counter
$currenthits = $stats['hits'] + 1;

// Update the hits counter
dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET hits = $currenthits WHERE sitekey = '".SITEKEY."' LIMIT 1");
$content = "<b>$currenthits</b> hits";

?>

 
Posted : 24/08/2009 8:37 am
(@tammy)
Posts: 2577
Member Moderator
 

This would REALLY be better done as a field in the stats table.


 
Posted : 24/08/2009 10:30 am
(@wimvincken)
Posts: 44
Eminent Member
Topic starter
 

That's an excellent idea! Why could't I think about that.

Let me finish sweeping and cleaning the roof, bird cages and wash the dog, my wife is bringing my son away to basketball and then I make those changes.

I also am working on a block, which displays who is online, but per page (i.e. members A, B and C are reading story 1, members T is reading story 5).


 
Posted : 24/08/2009 11:08 am
(@lyndsie)
Posts: 1263
Member Moderator
 

Once you've bathed your canaries or whatever it is, I have a suggestion for you. If you do that for Who's Online, then you should also consider making an opt-out for it. It's something that I think it should have anyway (I've had members ask for it), but especially if you're giving it more detail.


 
Posted : 24/08/2009 2:24 pm
(@wimvincken)
Posts: 44
Eminent Member
Topic starter
 

Once you've bathed your canaries or whatever it is, I have a suggestion for you. If you do that for Who's Online, then you should also consider making an opt-out for it. It's something that I think it should have anyway (I've had members ask for it), but especially if you're giving it more detail.

You mean to hide their names in the online user list?


 
Posted : 24/08/2009 3:08 pm
(@lyndsie)
Posts: 1263
Member Moderator
 

Yeah. A lot of forums and stuff that I've been to have that feature, so that you can opt to not show up in lists like that.


 
Posted : 24/08/2009 10:43 pm
Share: