acidglitter Posted September 3, 2007 Share Posted September 3, 2007 on some of my pages, i use the include('page.php'); function 4 or 5 times. it makes it a lot easier to manage some of my pages. is that a bad idea to use it so many times? will it make those pages take a lot longer to load? Quote Link to comment Share on other sites More sharing options...
Azu Posted September 3, 2007 Share Posted September 3, 2007 Yes, using lots of includes will make PHP take longer to create the page, so it will take longer to load. Quote Link to comment Share on other sites More sharing options...
acidglitter Posted September 4, 2007 Author Share Posted September 4, 2007 but will it take longer to load compared to a page that just has all of the content on one page without the includes()? Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 4, 2007 Share Posted September 4, 2007 I think it's a good idea, because it keeps your code organized. However, you have to pay attention to your errors and make sure you know what page to edit Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted September 4, 2007 Share Posted September 4, 2007 i have a few pages that have many includes and they dont take a long time to load on my browser. but like mentioned before by jesirose, pay attention to your errors and make sure you know which page contains what. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted September 4, 2007 Share Posted September 4, 2007 it depends on what is actually in the include file - some things you shoudl use require_once or include_once (like the html for the head section of a page) others you could include as many as you like if they perform a repetitive function. Quote Link to comment Share on other sites More sharing options...
Azu Posted September 4, 2007 Share Posted September 4, 2007 but will it take longer to load compared to a page that just has all of the content on one page without the includes()? Yes, there is much more overhead in opening up a file, reading it's contents, re-initializing the interpreter, interpreting the new file, and running it's code. There's just no comparison. Having your code in 1 file will be faster by leaps and bounds. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted September 4, 2007 Share Posted September 4, 2007 it sounds like the code in this file shoudl be a function or a class method. much better to call a function lots of times than execute 'standalone' script over and over again. Quote Link to comment 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.