Welcome! Please Login or Register!
April 10, 2020, 01:33:08 AM
Home Login Register
pftq Forums  |  Software and Scripts  |  Other Scripts and Tools  |  display random stats in title of website 0 Members and 1 Guest are viewing this topic. « previous next »
Latest News!VR Jetpack Game Trailer and Music(Jul 29, 2019)
Pages: [1] Print
Author Topic: display random stats in title of website  (Read 45048 times)
yippi
Member
*****
Offline Offline

Posts: 3

« on: April 13, 2008, 12:34:07 AM »

Hi there...

I want to random appear my stats in the title of my site. Is this possible? Currently only the "todaycount" is displayed in the title (look at http://www.sieke.be/index2.php) but on http://tweakers.net/ (a very popular site here in our country) they display random stats in the title. Is this possible with your script?

Thanks for the help!
Logged
pftq
Administrator
*****
Offline Offline



Posts: 4124

WWW
« Reply #1 on: April 13, 2008, 03:39:21 PM »

The counter is designed to be as flexible as possible for more advanced users.  While it does not have many "automatic" features", most of the output can easily be formated if you know a bit of PHP.

I'm not quite sure what you mean by random stats, but the below code (if used on your page) will use the counter to generate a random stat:

Code:
$arr=array("Total Counts"=>"total", "Total Hits"=>"total_hits"); // add other fields as needed
$pick=rand(0, count($arr)-1); $i=0; // -1 because array keys start at 0
foreach($arr as $k=>$v) {if($i==$pick) echo "$k: ".stat_($v); $i++; }

There is a better way instead of the foreach method but I forget how to grab an array value via index; it works just fine though.
Logged
yippi
Member
*****
Offline Offline

Posts: 3

« Reply #2 on: April 14, 2008, 01:22:57 AM »

I mean by random that when you load your page the title disyplays f.e. todaycount and when you reload your page it display f.e. the totalcount.... I know it's a .php thing but I cannot write PHP code (I can use code and tweak a little bit but not write it from start).
Thanks for the help... I'll try it this evening and let you know if it works!

Greetz
Logged
yippi
Member
*****
Offline Offline

Posts: 3

« Reply #3 on: April 14, 2008, 08:13:55 AM »

It worked! Thanks for your great help.
Logged
pftq
Administrator
*****
Offline Offline



Posts: 4124

WWW
« Reply #4 on: April 14, 2008, 06:45:29 PM »

You're welcome - glad it does work. Smiley
Logged
Pages: [1] Print 
pftq Forums  |  Software and Scripts  |  Other Scripts and Tools  |  display random stats in title of website « previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines | RSS Feed Valid XHTML 1.0! Valid CSS!
Page created in 0.791 seconds with 21 queries.