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.

How not to execute some code of javascript on some pages using php ?

Discussion in 'PHP' started by poseidon, Oct 3, 2007.

  1. #1
    I have put a javascript code on footer.php of my wordpress blog but I don't want it to execute on 404 page and few other posts/pages. How can I do this ?

    I know a simple IF expression will work but what is the exact code for it ?

    Thanks
     
    poseidon, Oct 3, 2007 IP
  2. woolf

    woolf Peon

    Messages:
    3
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can use echo. =)


    
    <?php
    echo '<script>alert("Here insert your JavaScript code.");</script>';
    php?>
    
    PHP:
     
    woolf, Oct 3, 2007 IP
  3. poseidon

    poseidon Banned

    Messages:
    4,356
    Likes Received:
    246
    Best Answers:
    0
    Trophy Points:
    0
    #3
    No, what I was asking was..I DO not want to show the script on some pages like /404 and /conatct-us and /about so I need something like this -


    [If page is Not /404 and /conatct-us and /about]
    echo Script

    And this code will go in the footer file.
     
    poseidon, Oct 3, 2007 IP