Page 1 of 1

that article on single page php sites

Posted: Tue Jun 03, 2003 11:54 am
by joeldg
umm..
okay not to be too picky, but why on earth would you use a switch? Every time you want to add a page you would need to code in another "case" stmt.

Why not just dynamically include it after you check if the file exists. (yes, php supports dynamic includes, and I hope they *never* change that)
i.e.

Code: Select all

if($page){
    include $page.".php";
}
This also makes testing easy as you can set up a test page and in the url just add it to see that it works, without screwing up your main page. And it is easy to set up so that it can't be hacked (i.e. remove ../../ and other chars)

I have been setting up sites like this for a long time (i.e. ipn.joihost.com, http://listbid.com/affil/ actually all of listbid.com etc etc.. etc...)

I agree with you that it is the coolest (and fastest) way to program sites (and by the way, googlebot loves them) and like that you are promoting gateway index sites, but using switch, in a larger site like listbid.com where I have 100+ subpages, it is just not workable.

-joedg

Posted: Tue Jun 03, 2003 1:14 pm
by pootergeist
ditto to what he said :)