shonuff... honestly thats total overkill...
pizza, I'll explain:
if (something) {
do something
} elseif (something else) {
do something else
}
means that if I did something, I won't do something else and vice versa.
the 'else' means literally what it says: ELSE. translated to english the code above means:
do something if something, else (otherwise) do something else if something else. it doesn't recheck the if statement and then go into the elseif statement.
the new code does this: if the page isn't defined, define the page.
if the page has a file associated with it, load the file.
the old code said: if the page isn't definied, define it. Otherwise if the page has a file, load the file.
The otherwise is what broke your code.