Seperate files or one index + includes?
Posted 17 July 2006 - 12:30 PM
What is the better option, having seperate files for each single page in your site that include() the header and footer information, like most sites do, or have one single index page - with the layout information in that - that includes pages depending on a $_GET variable? As far as I can see, there are pros and cons for each method. The first is easier, and has tidier URLs, while the second is easier to make large site wide global changes to. Which is better, and if there is no definate answer, which type is better in different situations?
Posted 17 July 2006 - 12:37 PM
this is one of those areas that is really a situational answer, like you referred to. if you have more pages that need individuality than uniformity on your site, you're definitely better off to make the separate pages, however, if your site requires uniformity across the scope, you most likely are better off combining as much of the code as you can. each case is different. you've also got to take into account how much SEO you are trying to do. many engines out there still do not fully follow PHP paths, so you're better off with a full directory structure that can easily be followed by spiders and robots. it all depends on the type of site and what kind of content you're displaying. there really isn't an easy answer to this question
Posted 17 July 2006 - 01:01 PM
I used to use a single loader (index.php) and then call the page based on the URL (index.php?page=page.php). But what had happened is that I started needing additional variables passed to the page and using includes you couldnt pass variabes thru the URL.
if I had:
And then later on in the page, I had:
That would be fine, but I couldnt do this:
This cuased major problems for me, and just recently decided to switch to having multuiple files with and include of the header and footer. I dont like (or rather didnt like) this style, but I have soared past my problems and am now much more productive. I agree that it is cleaner and seems more secure to use a single loader page, but I am making apps as opposed to simple web pages, and I constantly need to throw variables around.
Hope this helps.
I also agree with obsidian's post, it is totally a preference thing to do as well as based opn what you are trying to do (at one point I was happily using frames - it was a simple app on a private network where security wasnt an issue).
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users