Page 1 of 1

changing $font variable

Posted: Thu May 07, 2009 11:50 am
by entebbe
I'd like to change the font of a webpage every 25 seconds (in order to decide between a number of options).

I tried this, but it's definetly not working:

Code: Select all

 
<?php 
$i = 0;
$fonts = array('Trebuchet MS', 'Arial', 'Helvetica', 'sans-serif', 'Verdana', 'Georgia', 'Tahoma', 'Palatino', 'Gill Sans');
$font = $fonts[$i];
echo 'style="font-family: '.$font.';">';
$i = ($i + 1) % 9;
if (time() % 25 == 0) {
  $i += 1;}
?>
 
PS I did not forget that I have to click the refresh button. What did I do wrong?

Re: changing $font variable

Posted: Thu May 07, 2009 12:41 pm
by hawleyjr
You will need to use javascript to do this. PHP is server side only.