Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: statistics shown in graphics  (Read 12717 times)

0 Members and 1 Guest are viewing this topic.

xplicit

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 214
statistics shown in graphics
« on: August 31, 2004, 11:27:11 pm »

I just worked out a little script add on and want to share it with you.

(this is based on the functions of ssi.php or likewise functions, if you don't knwo how to use them this add on is just not for you)

The idea is the following I wanted my stats outside of the usual album stats so I could display it on the right menu bar of my page. The solution for that is using something like the ssi.php script or another scripts which connects to the sql database. I used a modified ssi.php script but I will show this example using a ssi.php function. Using these functions and gave the statistics in just plain text. I wanted it a bit more sophisticated so I decided to show the statistics in its graphical representation. The script is very simple

Code: [Select]

for ($digits = 0 ;$digits < strlen($variable) ; $digits++)
{
$imgsrc = substr($variable,$digits ,1);
echo "<img src =\"/digitdirectory/" . $imgsrc . ".imagetype \">";
}


This is what is does: it determines the number of digits in the variable. Each digit in the string will be the name of the graphical representation.

/digitdirectory/ is the directory your images are strored in. these images must have names like 0.xxx, 1.xxx, 2.xxx etcetra
the xxx can be gif, png, jpg etcetera.

.imagetype must be replaced by something like .gif, .png, .jpg etc.

To show the example I will give an example of a piece of ssi.php with the script in it so you can see how it COULD be used.

Code: [Select]

function cpg_total_comments()
{
GLOBAL $CONFIG,$cpg_decimal_point,$cpg_thousands_separator;
  $query = "SELECT count(*) FROM {$CONFIG['TABLE_COMMENTS']} WHERE 1";
  $result = mysql_query($query);
  $nbEnr = mysql_fetch_array($result);
  $comments_count = $nbEnr[0];
  mysql_free_result($result);

  for ($i = 0 ;$i < strlen($comments_count) ; $i++)
   {
   $imgsrc = substr($comments_count,$i ,1);
   echo "<img src =\"/digits/" . $imgsrc . ".gif\">";
   }
}


On the site : http://www.freehitcounters.net/ you can get over 150 templates of digit styles, just download the full digit serie of the one you want to use and put them in your digit directory.

Have fun with it and let me know if you liked/used it.

Xplicit
« Last Edit: May 05, 2006, 05:02:34 pm by GauGau »
Logged
Don't ask me: Can you do this .... or Give me that...or I need Quick help in PM's. I'm not Santaclaus so post your questions on the board so it will be in the benefit for everyone.

foryou

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: statistics shown in graphics
« Reply #1 on: April 05, 2007, 09:38:20 am »

enter : http://www.freehitcounters.net/


and ..... detected: Trojan program Trojan-Downloader.HTML.Agent.c - URL: http://traff.step57.com/mrx/
 :'(
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 19 queries.