Jump to content

Help using php within HTML


sac0o01

Recommended Posts

I am working on a chatbox script and am using html to set the colors for the text. 

 

First in config.php I define the values for the colors:

//Name color (sets color of name in messages)
  $nametextcolor = "6b9c69";
  
  //Message text color (sets color of messages)
  $messagetextcolor = "FF9900";

 

Then I use the variables in the html code:

<div class="<? echo $class; ?>" style="background-color:<? echo $bgcolor; ?>">
		<font color="<? echo $nametextcolor; ?>" >  <? echo $name; ?>:      </font>
		<font color="<? echo $messagetextcolor; ?>" > <? echo $text; ?></font>
		</div>

 

The problem is it does not change the color of $name only change the return for $text

 

Is there something I am missing here?

Link to comment
Share on other sites

I tried your code and I see both colors, not sure why it wouldn't work for you.

 

Some things you should know:

The <font> tag is deprecated in HTML 4, and removed from HTML5.

The World Wide Web Consortium (W3C) has removed the <font> tag from its recommendations.

In HTML 4, style sheets (CSS) should be used to define the layout and display properties for many HTML elements.

 

You should be using full php tags and not short, use <?php versus <?

 

A few helpful places to start learning css:

http://www.w3.org/Style/Examples/011/firstcss.en.html

http://www.tizag.com/cssT/

http://www.csstutorial.net/

http://htmlhelp.com/reference/css/

http://www.alistapart.com/topics/code/css/

http://www.cssbasics.com/

http://meyerweb.com/eric/css/

http://www.456bereastreet.com/archive/categories/css/

http://www.htmldog.com/

http://www.barelyfitz.com/screencast/html-training/css/positioning/

http://www.w3schools.com/css/default.asp

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.