|
-
Mar 12th, 2004, 03:03 AM
#1
most efficient/best way to structure a php site
Ok, in the past I've always had a main file (usually index.php) and then included files through GET requests, always checking if I should allow the file to be included.. so, I usually called files with "index.php?pg=main" or something like that. Now, I notice a lot of sites use seperate PHP files for each page.. and I always thought that'd be a hassle to do, so, they have index.php, news.php, register.php, login.php, and all the others.. where they include a header.php and then a footer.php, maybe a menu.php or whatever.. and I'm wondering which is more efficient, or which one is more 'preferred.' I prefer the include thing, mostly because it requires less work on my part and pretty much produces the same results. It's also easy to change the site's layout because you just change the main page and the whole layout's changed, and then you can tweak the inner-PHP files to customize it better, rather than going through all of the files and changing the order of the includes if they changed the place of the menus..
I notice that Invision board uses a mix of both, although the query method is used a hell of a lot more..
just want some opinions before I start building this site of mine, and then getting told something and then going through and redoing it all.
so, is there any major advantages of using one over the other, other than the one's I've stated? And is there any other proficient way of structuring a site?
-
Mar 12th, 2004, 07:48 AM
#2
Frenzied Member
I've stated my actions for certain types of documents (reporting), but for a full site, I usually have seperate pages for each function (register.php, order.php, contact.php, etc.) and I include a header/footer. Now keep in mind that for the most part, the header and footer are the majority of the design, and the other pages just have a couple includes. So really, doing it this way, when you want to change how the site looks, you change the footer and header files and you're pretty much done. My initial page is usually set up somewhat drastically different from the rest of the site, so that's why I don't base my entire site off of that page.
But hey... that's just how I do it. It's all up to preference and the layout of your site really.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|