1. This website uses cookies. By continuing to use this website you are giving consent to cookies being used.
    For information on cookies and how you can disable them visit our Cookie Usage page.
    Dismiss Notice

PHP Can you edit a base template and have it automatically edit every page??

Discussion in 'Web Development' started by nourseman, Oct 29, 2008.

  1. nourseman

    nourseman New Member

    Okay, I'll admit, I'm a bit of a noob, so I apologize in advance for any ignorance on my part. I appreciate anyone who can shed some light on this topic for me!!!! :D

    I'm in the process of designing a website and I want to know how I can create an overall base template that will have the same menu and resource links on every page within the site, and when I edit the base template it is reflected on every page automatically. Meaning, if I make a simple change to the template (say one of the menu items), is there a way that I can have that change reflected without me having to go through every page within my site and update that specific page's menu html? This could be a VERY tedious process if I have a hundred pages within my site.

    Any help you could offer would be MOST appreciated!!!!
     
  2. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    This one has been answered before.
    You will have know "php" here is a good tutorial http://www.tizag.com/phpT/include.php

    You are going to create a master file which has all your menu items and use the "include command" in your pages. Your pages will have to have a php extension. You can still write the rest of the file in html.
    As a file with a php or a html extension will display in any browser. You can easily take a index.html rename it index.php and view it in your browser.
    Many programs are written this way, like Wordpress, Forums and others.
    Just becarefull and do not use to many includes or your site will be slow to load and put a strain on the server, by consuming to much bandwidth.