PDA

View Full Version : includes or no includes



designguru
May 6th, 2009, 03:43 AM
Hi All
I have got a project to maintain a medium size PHP website with 200 pages. But I wondered when I found each and every page is static HTML. Even Top navigation, right navigation, footer is static HTML, and if you want to change a single character in navigation you'll have to change in 200 pages!!!! I want to get rid of unnecessary time killing work & asked my client to go for template but he is not ready to go for.
He is saying templates / includes increases loading time than static HTML. I am very skeptic on his views. Then why people use templates/includes? is it really a hurdle for user experience? Please let me know.
Also let me know why we should use template/includes rather than static HTML.

Due to privacy I wont be able to post the URL. But I need your help.

Thanks & Regards-
developersouvik (http://developersouvik.orgfree.com/)

NeoDreamer
May 7th, 2009, 06:09 PM
Are you referring to Dreamweaver's templates? Those basically just automatically copy and paste template changes to all other files using the template when you make a change. This kind of template increases the file size of your entire website because there is much repeated HTML.

Using includes will lower your entire website's file size by storing commonly used layout elements in a common file. However, don't confuse this with faster loading times for users. Using includes may actually be a split second slower than sending normal HTML, because the server must piece together the site before sending it off to the client. In the end, both the include method and template method will be sending off a page of the identical size.

The time difference in processing a PHP/any server file with includes is miniscule. It is recommended that you use includes over the template method because it will make your code much more manageable. In the computer science world, no one actually makes everything goes as fast as possible. If everyone did, all code would be written directly in assembly with clever speed hacks everywhere. Since these hacks and assembly itself is so hard to maintain, almost no one does this.