SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict Divisive Cotton's Avatar
    Join Date
    Jun 2008
    Location
    Andy lives in London, UK
    Posts
    393
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question $_SERVER['blog.php'] ... ?

    Is there some superglobal or function that I can use in the flow such as

    if( // particular file) {

    do this

    } else {

    do this

    }

    i want to display something on the blog.php page and only on the blog.php page
    Let everyday be Christmas

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,495
    Mentioned
    161 Post(s)
    Tagged
    4 Thread(s)
    Just put it only in the blog.php page script?
    I guess I don't quite understand what you want to do

  3. #3
    SitePoint Addict Divisive Cotton's Avatar
    Join Date
    Jun 2008
    Location
    Andy lives in London, UK
    Posts
    393
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what it is is that I have the script in the blog.php file.

    So it reads

    if($category) {

    display category information

    } elseif($page) {

    display page information

    } else {

    at the moment that displays the index content

    }

    I'm just trying to work out a way of displaying a 404 for a mistyping because at the moment every mispelt url after blog.php? leads to the index...

    So I would like something

    } elseif(blog.php) {

    index page info

    } else {

    404

    }

    I think that makes sense...

    Let everyday be Christmas

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,495
    Mentioned
    161 Post(s)
    Tagged
    4 Thread(s)
    because at the moment every mispelt url after blog.php? leads to the index...
    Why? Because if the url doesn't exist, $page isn't true? Do you do some kind of check in the script to check the existance of the passed url?
    If so, just use another variable, for example $error, and set it to true if the passed url doesn't exist, and then add another if that says:

    PHP Code:
    } elseif($error) {

    404

    } else {

    index page info




Bookmarks

Posting Permissions

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