Submit Your Article Forum Rules

Page 1 of 6 123 ... LastLast
Results 1 to 10 of 53

Thread: include or no include

  1. #1

    include or no include

    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
    Developersouvik [Technology & creativity Spun together]
    Hidden Content

  2. #2
    WebProWorld MVP DaveSawers's Avatar
    Join Date
    Dec 2006
    Location
    Lunenburg, Nova Scotia, Canada
    Posts
    704

    Re: include or no include

    Quote Originally Posted by subho View Post
    He is saying templates / includes increases loading time than static HTML.
    No it doesn't. It'll make no difference whatsoever as the HTML downloaded to the browser is exactly the same. To reduce page size, things like Javascript and CSS should be put in separate files so they are only downloaded once for the entire site.

    Quote Originally Posted by subho View Post
    Also let me know why we should use template/includes rather than static HTML.
    Because it reduces maintenance time, and therefore cost.
    Dynamic Software Development
    Hidden Content

  3. #3
    WebProWorld MVP kgun's Avatar
    Join Date
    May 2005
    Location
    Norway
    Posts
    7,713

    Re: include or no include

    Quote Originally Posted by DaveSawers View Post
    No it doesn't. It'll make no difference whatsoever as the HTML downloaded to the browser is exactly the same.
    I disagree and have experienced it myself. Putting markup in php includes reduces page load time. There is nothing faster than static markup. If that markup (and styling) is reused that is a different question.

    Quote Originally Posted by DaveSawers View Post
    To reduce page size, things like Javascript and CSS should be put in separate files so they are only downloaded once for the entire site.
    Agree.

    Quote Originally Posted by DaveSawers View Post
    Because it reduces maintenance time, and therefore cost.
    Agree.
    Hidden Content :: Hidden Content
    Hidden Content
    Conversations creates communities and conversions create profit.

  4. #4
    WebProWorld MVP wige's Avatar
    Join Date
    Jun 2006
    Posts
    2,981

    Re: include or no include

    Quote Originally Posted by subho View Post
    He is saying templates / includes increases loading time than static HTML.
    It is true that using server side includes and php will increase the time it takes for pages to be served. However, the increase is minimal. Compared to the time that it takes for the client to send the request to the server and the server to send the page to the client (latency), the time that the server spends actually creating the document (overhead) is not noticeable. We are probably talking about a delay on the factor of thousandths of a second - a delay longer than 1/32 of a second can't even be detected by the human brain. Users can't tell the difference.

    Also, I should note that if the site is written in PHP, every page is already being delayed because the pages have to pass through the PHP processor anyway - even if there is no actual PHP code in the pages, they still get parsed by the server just on the basis that the file extension is .php. So, you are already delaying the serving of the pages anyway.
    The best way to learn anything, is to question everything.
    Hidden Content

  5. #5
    WebProWorld MVP kgun's Avatar
    Join Date
    May 2005
    Location
    Norway
    Posts
    7,713

    Re: include or no include

    Quote Originally Posted by wige View Post
    Also, I should note that if the site is written in PHP, every page is already being delayed because the pages have to pass through the PHP processor anyway - even if there is no actual PHP code in the pages, they still get parsed by the server just on the basis that the file extension is .php. So, you are already delaying the serving of the pages anyway.
    That is also correct.

    Message:

    If you only want a small static branding site, use htm for semantic markup and a simple side wide style sheet that is loaded once in the web servers memory for design.
    Hidden Content :: Hidden Content
    Hidden Content
    Conversations creates communities and conversions create profit.

  6. #6

    Re: include or no include

    I do use includes although not with PHP and they are a time saver. If your client refuses to listen, there are some good Global Search and Replace programs out there that will also do the trick. Just have to be careful with them. Also, you have to upload all the pages instead of just one like you would with an include.
    Kevin

  7. #7

    Re: include or no include

    Quote Originally Posted by kevinper View Post
    I do use includes although not with PHP and they are a time saver. If your client refuses to listen, there are some good Global Search and Replace programs out there that will also do the trick. Just have to be careful with them. Also, you have to upload all the pages instead of just one like you would with an include.
    I'm REALLY glad this post caught my attention. It answers my own post about replacing navy text with black text.

    Thanks for reminding me about global search and replace.

    Steph
    Hidden Content and Hidden Content for Friends, Family and Dogs.
    Hidden Content

  8. #8
    WebProWorld MVP SemAdvance's Avatar
    Join Date
    Dec 2005
    Posts
    1,011

    Re: include or no include

    Static pages with individual header files load faster and are also a better choice from an organic rankings standpoint.

    If your client is ranking well for a great many keywords using static pages you could do more harm than good switching to an includes based set up.

    Might want to check his organic SEO & traffic levels before committing to the changes.

  9. #9
    Junior Member
    Join Date
    Sep 2006
    Posts
    26

    Re: include or no include

    Usually as a developer you can take a clients static site and recreate it using a much more efficient template so that you can implement php includes and actually have it running much faster.

    This is done by removing tables and replacing with css, optimizing javascript, moving css and javascript to external files so they are cached, removing junk code, optimizing image sizes, etc.

    Then use gzip or zlib compression and the page will be delivered faster.

    Using a php program such as MMCache, AfterBurner, Zend Cache, PHP Accelerator etc. will help prevent php overhead.

    You can also force .html pages to load the php includes to keep the urls the same. If you keep the same urls, page titles, meta descriptions and page content you won't see any change in SEO positioning.

  10. #10
    Junior Member webgoddess's Avatar
    Join Date
    Aug 2003
    Posts
    20

    Re: include or no include

    Another option for static HTML pages is to use the Dreamweaver template feature. It is lovely - if you make a change in your template, all pages that use that template will change, then you just upload. It might be a little painful converting the site to using a template, though.

    BTW, there is a line you can put in your htaccess file so that you can name your php pages with an html extension and it will execute any php codes you put in the page.

    I find that pages that I use a header and footer include actually load faster once the include is cached for the site. Maybe it's just my imagination...
    Irene Hartfield "The Webgoddess"

Similar Threads

  1. Why php include does not show?
    By edhan in forum Web Programming Discussion Forum
    Replies: 25
    Last Post: 03-20-2010, 09:33 PM
  2. PHP include
    By jgarner in forum Web Programming Discussion Forum
    Replies: 2
    Last Post: 08-14-2006, 09:22 AM
  3. Using php include
    By timbrux in forum Web Programming Discussion Forum
    Replies: 3
    Last Post: 10-08-2005, 09:48 AM
  4. What is the best include method?
    By MrLeN in forum Web Programming Discussion Forum
    Replies: 5
    Last Post: 11-29-2004, 06:19 PM
  5. Using a SSI Include within an XSL document?
    By maddhacker24 in forum Web Programming Discussion Forum
    Replies: 6
    Last Post: 05-25-2004, 05:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •