Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Simple If-Statement Not Working

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #32123
    StephBertha
    Participant

    Hey there,

    I have an if statement (not in WordPress; just a simple PHP site) that refuses to work. Thought it was right, guess it’s not?

    Code I have in between my HEAD tags:








    Code I have after my BODY:


    $path = $_SERVER;
    $page = basename($path);
    $page = basename($path, '.php');
    $dir = substr(strrchr(getcwd(), '/'), 1);
    ?>

    I also have the code from Chris Coyier to create a body ID on every page:



    But I can’t figure out how to call a body id even if I wanted to try that way.

    Anybody have any thoughts?

    – Steph

    #53969
    TheLeggett
    Member

    It looks like you’re defining your $page variable after you begin the if() statement. If the variable hasn’t been set to “obituaries” yet, it shouldn’t meet that condition.

    I think that’s the problem anyways!

    #53667
    StephBertha
    Participant

    That would make sense, I’ll try that!

    Thank you.

    – Steph

    #53607
    StephBertha
    Participant

    That worked, thank you!

    – Steph

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.