Hi
I would just keep the money value in a file and go from there! It's better than doing a query to get that value....
example.....
create a file called 'whatever', my example uses 'funds.php', I use php file so people can not look at what is the value by just calling the file!
Follow me....
create a file called 'funds.php'
Inside that file put....
the money you have collected so far...
Code:
<?
$raised_money = 23.85;
?>
Now create a script called 'fundraising.php'
Put that in your './includes/ directory
Inside that file put this....
Code:
<?
define ( 'SYS_EOL', ( strtolower ( substr ( PHP_OS, 0, 3 ) ) == 'win' ? chr ( 13 ) . chr ( 10 ) : chr ( 10 ) ) );
/* define the path to the font to use */
define ( 'SYS_FSP', './fonts/gooddogcool.ttf' );
function update_funds ( $file, $value )
{
$io = fopen ( $file, 'w' );
fputs ( $io, '<?' . SYS_EOL . SYS_EOL . '$raised_money = ' . $value . ';' . SYS_EOL . SYS_EOL . '?>' );
fclose ( $io );
}
function display_value ()
{
global $raised_money;
$text = '$' . $raised_money;
$image = imagecreate ( 164, 40 );
$backg = imagecolorallocate ( $image, 255, 255, 255 );
$textc = imagecolorallocate ( $image, 51, 102, 153 );
$fsize = 36;
$angle = 0;
$horzp = 28;
$vertp = 32;
imagerectangle ( $image, 0, 0, 163, 36, $textc );
imagettftext ( $image, $fsize, $angle, $horzp, $vertp, $textc, SYS_FSP, $text );
header ( 'Content-type: image/gif;' );
imagegif ( $image );
imagedestroy ( $image );
}
?>
You will have to change the path to the font and the font type used!
Now create another file that will be used to call the IMAGE....
I will use 'show.php'....
in that file put this....
Code:
<?
include_once ( './funds.php' );
include_once ( './includes/fundraising.php' );
display_value ();
?>
Now to show the image!
In any template on your forum you would do this....
Code:
<img border='0' src='http://site.com/show.php' height='40' width='160' alt='' />
The result would be...
http://24.91.149.80/show.php
To update the value of money raised you would do this....
Code:
<?
include_once ( './includes/fundraising.php' );
update_funds ( '.funds.php', '56.50' );
?>
where as './funds' would be the file you are using to hold the money raised value!
and '56.50' would be replaced with the new real money raised value!
Sonia