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
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?
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!
That would make sense, I’ll try that!
That worked, thank you!