using php to call for different styles?

Discussion in 'PHP' started by Hades, Nov 6, 2008.

  1. #1
    Hey Guys,

    I am trying to code a wordpress site, and I am using the following php statement in the <style></style> but for some reason it isn't working. Like, it understands it, and if I look at the source, it puts out what it's supposed to put out, but it doesn't intergrate it into the page or the css. Any clue why? Or should I be asking this on the css/html forum?

    body { background-image:<?php if (is_front_page()) { 
    echo "url(images/bg-front.png)";
    }
    else { "url(images/bg.png)";
    } ?>;
    PHP:
    It only doesn't work when I try to put in an image. If I for example do background-color: or width: it works.

    Any help will be appreciated.

    Regards,
    Nick
     
    Hades, Nov 6, 2008 IP
  2. money4leads

    money4leads Well-Known Member

    Messages:
    117
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    #2
    try to echo after else !
     
    money4leads, Nov 6, 2008 IP