Maelstrom Posted July 17, 2006 Share Posted July 17, 2006 I am sure this has been asked before, but i couldnt find any mention of it anywhere.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?Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/14834-seperate-files-or-one-index-includes/ Share on other sites More sharing options...
obsidian Posted July 17, 2006 Share Posted July 17, 2006 welcome to the forums! i hope you find lots of great helps and advice here.this is one of those areas that is really a situational answer, like you referred to. if you have [b]more[/b] 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 ;) Quote Link to comment https://forums.phpfreaks.com/topic/14834-seperate-files-or-one-index-includes/#findComment-59282 Share on other sites More sharing options...
outlawsfh Posted July 17, 2006 Share Posted July 17, 2006 Just to think about: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.For example:if I had:index.php?page=page.phpAnd then later on in the page, I had:include ('page.php');That would be fine, but I couldnt do this:include ('page.php?somethervar=foo');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).Take care.... Quote Link to comment https://forums.phpfreaks.com/topic/14834-seperate-files-or-one-index-includes/#findComment-59295 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.