Forum Moderators: coopster

Message Too Old, No Replies

change font size

         

meanweaver

11:01 pm on Aug 24, 2004 (gmt 0)

10+ Year Member



I need a little help in changing the output of a script with the font size, I am using a users online script, but the output of the font is not specified so it comes out as the browser default size. this is the echo statement

// Show all users online
if ($user==1) {echo $user.' user online';} else {echo $user.' users online';}
?>

Is there a way to add something to this to output a differant font size, I am clueless with php, Not even sure if this is the bit of the script that will change this.

Regards Ian

Timotheos

11:14 pm on Aug 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Ian,

Just echo some html tags around it.

// Show all users online
echo '<font size="10">';
if ($user==1) {echo $user.' user online';} else {echo $user.' users online';}
echo '</font>';
?>

Could be anything else you want like a div tag...

Tim

dkin

11:53 pm on Aug 24, 2004 (gmt 0)

10+ Year Member



hate all on one line

// Show all users online
if ($user==1) {
echo ''.$user.' user online';
}
else {
echo ''.$user.' users online';
}
?>

if you would like the font sizes to be different just add your font tags between the quotes I have placed.

meanweaver

6:23 am on Aug 25, 2004 (gmt 0)

10+ Year Member



Thankyou very much for the information.

Regards Ian

ergophobe

2:48 pm on Aug 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Not really a PHP issue, but fixed font sizes are evil ;-) It will prevent many users from being able to read your site.

As Timotheos said, you could wrap it in a some other tag and style it:

echo '<p class="users-online">';
if ($user==1) {echo $user.' user online';} else {echo $user.' users online';}
echo '</p>';

Then have, in your css
.online {font-size: 80%;}

This will make your site much more usable.

Tom

Timotheos

3:28 pm on Aug 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Tom. Yes I did hint at it but I went for the easy answer.