YNWA Posted March 31, 2007 Share Posted March 31, 2007 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 More sharing options...
shocker-z Posted March 31, 2007 Share Posted March 31, 2007 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 Link to comment https://forums.phpfreaks.com/topic/45064-help-with-some-php-code/#findComment-218772 Share on other sites More sharing options...
kenrbnsn Posted March 31, 2007 Share Posted March 31, 2007 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 Link to comment https://forums.phpfreaks.com/topic/45064-help-with-some-php-code/#findComment-218794 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.