1. Separate pages.

Each page coded completely independently.

2. Index page with content as included files.

An index page with everything that would appear on every page coded in then a simple if statement to check which page should be displayed, likely depending on the URL (e.g.: index.php?page=news).

3. Content pages with included header/footer.

All code that is needed on every page is stored in files which are included in each page.

4. None/Other.

Self explanatory. Please give details.

---

I'm just wondering everyone's opinions on this and their reasons for choosing it.

I know that 2 and 3 are very similar but I would go with 3 as it means the end user could find pages easier. I don't know about the rest of you but I find it generally easier to remember something like http://site.com/videos than http://site.com/?page=videos but I am aware that you could set the server to redirect any calls for http://site.com/videos to http://site.com/?page=videos but my way also means that you could have slightly different header files and include different ones depending on the part of the site. For example, if you have a site about video games, in your PS3 section, you may want your header image to contain a PS3 and in your 360 section to contain a 360.

I chose number 3, mostly for the same reasons as you.

I agree, and http://site.com/videos is far more user friendly.

Why not store the photos for each system in an array, and use a function to check which page the user is on, then display the picture accordingly?

Regards, Arkinder

I was just using that as an example as I couldn't think of anything else at the time. I suppose a better example would be if you had a forum on your site and you don't want the normal header/footer on that section so you have separate forumheader.php and forumfooter.php files.

The file size and load time would basically be the same, so it shouldn't really matter. Of course there is always the option of putting the code for those specific pages in manually, but that has potential to get in the way.

PHP functions for changing the included output based on the page, address, click, etc. is still an option, but that seems like a waste of server time.

Regards, Arkinder

#2, index.php behaves as a page handler, and you use mod_rewrite to format them into pretty urls. Then your inner directory structure can be as organized as you like. Doing it this way is also leaning towards a FrontController pattern.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.