Jump to content

Help with some PHP Code?


YNWA

Recommended Posts

Didnt really know where to put this, but here goes...

 

I have a few pieces of PHP code than I need solving first off is this, I need the text to display in Red and also italics. Its simple if you know how but unfortunatley I dont, anyone out there?

 

I have so far:

 

<?php

 

function nSFont ($txt,$size,$italics,$colour)

 

{

echo ("<font size=\"$size\"face=\"Helvectica,Arial,Sans-Serif, red, italics\">

$txt,<?font>");

}

nSFont ("What You Looking At?<br>",10);

nSFont ("YOU!<br>",6);

?>

 

But all i get is the text in normal black font, any help would be great?

Link to comment
https://forums.phpfreaks.com/topic/45064-help-with-some-php-code/
Share on other sites

Try this mate

 

<?php

function nSFont ($txt,$size,$italics,$colour)

{
if ($italics == 1) {
  $eml='<em>';
  $emr='</em>';
}
echo ("<font color='$colour' size='$size' face='Helvectica,Arial,Sans-Serif'>".$eml.$txt.$emr."</font>");
}
nSFont ("What You Looking At? (Italic)",10,1,'red');
nSFont ("What You Looking At?",10,0,'red');
nSFont ("green (Italic)",10,1,'green');
nSFont ("green ",10,1,'green');
?>

 

 

 

Regards

Liam

Here's a modification of shocker-z's code that uses CSS coding instead of the <font> tag:

<?php
function nSFont ($txt,$size,$italics,$colour)

{
$eml = ($italics)?'font-style:italic':'';
return '<span style="color:' . $colour . ';font-size:' . $size . 'px;font-family:Helvectica,Arial,Sans-Serif;' . $eml . '">'.$txt.'</span>';
}

echo nSFont("What You Looking At? (Italic)",14,true,'red').'<br>';
echo nSFont ("What You Looking At?",14,false,'red').'<br>';
echo nSFont ("green (Italic)",16,true,'green').'<br>';
echo nSFont ("Blue ",16,true,'blue').'<br>';
?>

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.