forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: content syndication (cpmFetch) => Topic started by: xplicit on August 31, 2004, 11:27:11 pm

Title: statistics shown in graphics
Post by: xplicit 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
Title: Re: statistics shown in graphics
Post by: foryou 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/
 :'(