How can I include html, php, and javascript in one file across many pages?

Discussion in 'HTML & Website Design' started by Imozeb, Feb 15, 2010.

  1. #1
    I want to create 1 file that is inserted into all of my pages (i.e. for header, links, navs), so that when I edit that file it changes everything about that part of my webpage. Note: I don't just want to edit the style of the table, font, and stuff like that, I want to be able to edit the entire table, server and client scripts, images, and content.

    Is there anyway I can do this?

    ~imozeb
     
    Imozeb, Feb 15, 2010 IP
  2. kreativi

    kreativi Peon

    Messages:
    89
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Short answer: Yes, it is possible.

    What I have understand is that you want to update and upload a single file that can update content of specific part of all your web pages.

    You can do it easily by creating your pages in php. You can simply call an external file into the existing page by using include command. It is as follows;

    <?php include("filename.php"); ?>

    I hope you have understood it.
     
    kreativi, Feb 15, 2010 IP
  3. LeetPCUser

    LeetPCUser Peon

    Messages:
    711
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #3
    This include works and is the best way to do it, but make sure the page you are doing this on has a .php extension, not .html, i.e. index.php.
     
    LeetPCUser, Feb 15, 2010 IP
  4. Imozeb

    Imozeb Peon

    Messages:
    666
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Okay, thanks guys. I knew about the PHP include function but I wasn't sure it was the most efficient way of doing what I wanted.
     
    Imozeb, Feb 15, 2010 IP