Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts

    Background code inside a php function

    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?

  • #2
    Regular Coder
    Join Date
    May 2008
    Location
    Ohio
    Posts
    231
    Thanks
    3
    Thanked 21 Times in 21 Posts
    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).
    zok@zoklet:~$ whereis zok
    zok: http://zoklet.net | http://zoklet.net/otg | /derzok/at/gmail/dot/com

  • #3
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    I would use a PHP if statement.

    PHP Code:
    if (true) {

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

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



    --------
    Leonard Whistler

  • #4
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •