11-29-2007, 06:07 PM
|
#10 (permalink)
|
|
The Acquainted
Join Date: Nov 2007
Posts: 127
Thanks: 14
|
Quote:
Originally Posted by bluesaga
PHP Code:
switch ($state)
{
case "home":
//full html doc and php inserting variables, including header and footer. no includes, just copy + paste html
break;
case "account":
//full html doc and php inserting variables, including header and footer no inlcudes just copy + paste html
break;
}
|
LOL
When I first got into PHP, a friend of mine told me how he made all of his dynamic sites using only one file (index.php). I couldn't believe my eyes! I was amazed and used it on a few sites until I saw the downfall. Although, my index.php used if statements as if they were going out of style. Actually, I didn't even know what a switch statement was either. The worse part of it all was that I didn't put a common header and footer in my index.php. Each 'page' would contain EVERYTHING including the doctype. Needless to say, updating my site sucked ass.
Not too long later, someone told me about seperating my header and footer into their own entity and simply including them on the top and bottom of my script. I nearly soiled mysql when I learned this nifty trick.
:)
|
|
|
|