Page 1 of 1
php website in one file?
Posted: Wed Feb 14, 2007 10:06 am
by dhrosti
I'v got a small site to build and i was just wondering if there are any advantages to building it all within one file, using a big switch statement or something to display the different content. It might make it a bit simpler to share common variables, session checks, etc. Anyone have any thoughts on this?
Posted: Wed Feb 14, 2007 10:09 am
by CoderGoblin
Maintenance would be a nightmare

Posted: Wed Feb 14, 2007 12:22 pm
by feyd
That's what
include() is for.

Posted: Wed Feb 14, 2007 12:26 pm
by superdezign
Break everything up into separate files, and put
Code: Select all
if(preg_match('/pagename'/, $_SERVER['PHP_SELF'])) header("Location: index.php");
at the top of every file to stop people from straying.
And to determine which page you're on, $_GET variables would handle it well.