Hi, I'm definitely a newbie - and wondering how to change text color in PHP.
Like if I wanted to make this a color - how could I do that?
define('HEADING_TITLE', 'Welcome to the Daily Gourmet.');
Thanks in advance for your help.
Hi, I'm definitely a newbie - and wondering how to change text color in PHP.
Like if I wanted to make this a color - how could I do that?
define('HEADING_TITLE', 'Welcome to the Daily Gourmet.');
Thanks in advance for your help.
PHP does not have a "text color".
PHP simply executes code on the server, and outputs (usually) HTML to the user. It is like designing an .HTML page, except you just give the server instructions on how to design it.
It sounds as though you should be reading more about what PHP is and does. You can learn more about PHP at php.net
I'm sorry, you must have misunderstood my question. I do understand the underlying principle of PHP - I'm wondering how to go about changing the color of the text displayed as HTML output. For instance, where do I place the HTML tag relative to the rest of the scripting? I don't just want to change the color of the text as I'm doing the PHP scripting, I want the outputted text do be a different color.
Thanks.
I don't just want to change the color of the text as I'm doing the PHP scripting, I want the outputted text do be a different color.
If I understand correctly, you're worried about changing the font color of the PHP code itself? PHP code is just plaintext on the server... if you're echo'ing text, simply echo the HTML:
echo "This is <font color=\"blue\">blue</font>!";
NOTE: In your above example, to output the text in green, you would do:
echo '<font color="green">' . HEADING_TITLE . '</font><br>';
I'm sorry, I'm doing an awful job of making myself clear.
Say I have this script:
define('HEADING_TITLE', 'Welcome to the Daily Gourmet.');
And when the text "Welcome to the Daily Gourmet" is outputted to the user, I would like that text to be a certain color. Would I embed HTML somewhere within the function in order to accomplish that?
Yes, using the code I suppled under "NOTE:" would do just that. Just echo the HTML font tags around your constant.