php website in one file?
Moderator: General Moderators
php website in one file?
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?
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Break everything up into separate files, and put
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.
Code: Select all
if(preg_match('/pagename'/, $_SERVER['PHP_SELF'])) header("Location: index.php");And to determine which page you're on, $_GET variables would handle it well.