View Full Version : Background code inside a php function

08-04-2008, 08:58 PM
Instead of setting up a css background code using a div, or by using the body bgcolor in html. Is there another way to code a background in php?

So when I go to my function its a plain white background. I would like to use some kind of coding thats like <background color="#CD73A8"> or something. Possible?

08-04-2008, 09:12 PM
PHP is server side and won't do that. You can have PHP print something that WILL do that - but that wouldn't be php, that'd be whatever php prints (html or javascript).

Len Whistler
08-04-2008, 10:17 PM
I would use a PHP if statement.

if (true) {

echo "<background color=\"#CD73A8\">";

} else {
echo "<background color=\"#000000\">";


08-04-2008, 10:42 PM
Hmm don't have any statements needed to be true in this.

So say I put a CSS called #blah and only had a background color in it.

and in the script did echo "<div class="blah">Content here</div>";

Would that work?