1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

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