Hi there, I've made a minor aesthetic change to the way the formatage PHP function works and figured I'd share it, instead of returning a value like "8.36 hours" it returns a full string like "2 days 20 hours 42 mins".
This unfortunately had the side effect or messing with the tables with the text often wrapping onto two lines, I overcame that by widening a couple of fields in the css file.
In common.php:
PHP Code:
function formatage($date) {
$nametable = array(" sec", " min", " hour", " day", " wk", " month", " year");
$agetable = array("60", "60", "24", "7", "4", "12", "10");
$ndx = 0;
while ($date > $agetable[$ndx]) {
if ($ndx != 0) {
if ($date % $agetable[$ndx] != 1) {
$returnvalue = $date % $agetable[$ndx] . $nametable[$ndx] . "s " . $returnvalue;
} else {
$returnvalue = $date % $agetable[$ndx] . $nametable[$ndx] . " " . $returnvalue;
}
}
$date = $date / $agetable[$ndx];
$ndx++;
next($agetable);
}
if ($date % $agetable[$ndx] != 1) {
$returnvalue = $date % $agetable[$ndx] . $nametable[$ndx] . "s " . $returnvalue;
} else {
$returnvalue = $date % $agetable[$ndx] . $nametable[$ndx] . " " . $returnvalue;
}
return $returnvalue;
}
In style.css:
Code:
#page {
width: 1024px; /* was 875 */
margin: 0 auto;
}
#content {
float: left;
width: 750px; /* Was 600 */
}
Not sure this is the best way to go about it but it works for me so far
You can see an example at
http://l4dstats.rsbox.co.uk/
Also I put together a population file for the UK, the data for it was bloody hard to find and I had to change the population_minkills to a far lower value in config.php (200) because... well a value of 3000 cut out over 3/4s of the data