Avoiding Duplicating Code

Discussion in 'HTML' started by Robb, Nov 14, 2006.

  1. Robb

    Robb Guest

    My header (images and a couple links), main menu, and footer are the same on all pages. Can they be
    put into an external file instead of duplicated on every page?

    Thanks,
    Robb
    Robb, Nov 14, 2006
    #1
    1. Advertising

  2. Robb

    Nico Schuyt Guest

    Nico Schuyt, Nov 14, 2006
    #2
    1. Advertising

  3. Robb

    password Guest

    "Robb" <> wrote in message
    news:...
    > My header (images and a couple links), main menu, and footer are the same

    on all pages. Can they be
    > put into an external file instead of duplicated on every page?
    >

    php and includes

    make main content bit a php file
    make your header menu etc a separate html file
    make footer a separate html file

    then at top and bottom of php page do

    <?php
    include('whereeveritis/header.html');
    ?>

    php content stuff goes here
    <?php
    include('whereeveritis/footer.html');
    ?>

    'whereveritis' is the route to the html files
    you may have to fiddle with route to your css because the 'includes' think
    (behave as if) they are where the php page is located even if they are in a
    different folder

    i hope that is clear
    password, Nov 14, 2006
    #3
  4. Robb

    Robb Guest

    Thanks, I'll give this a try.


    On Tue, 14 Nov 2006 23:31:45 -0000, "password" <> wrote:

    >
    >"Robb" <> wrote in message
    >news:...
    >> My header (images and a couple links), main menu, and footer are the same

    >on all pages. Can they be
    >> put into an external file instead of duplicated on every page?
    >>

    >php and includes
    >
    >make main content bit a php file
    >make your header menu etc a separate html file
    >make footer a separate html file
    >
    >then at top and bottom of php page do
    >
    ><?php
    >include('whereeveritis/header.html');
    >?>
    >
    >php content stuff goes here
    ><?php
    >include('whereeveritis/footer.html');
    >?>
    >
    >'whereveritis' is the route to the html files
    >you may have to fiddle with route to your css because the 'includes' think
    >(behave as if) they are where the php page is located even if they are in a
    >different folder
    >
    >i hope that is clear
    >
    Robb, Nov 16, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AC
    Replies:
    0
    Views:
    518
  2. Don

    Duplicating datasheet screens

    Don, Feb 23, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    351
  3. Todd Plambeck

    ASP.Net Duplicating DB Entries

    Todd Plambeck, Aug 5, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    499
  4. George Jempty

    log4j duplicating appender entries

    George Jempty, Jan 7, 2005, in forum: Java
    Replies:
    2
    Views:
    2,470
  5. johkar
    Replies:
    0
    Views:
    340
    johkar
    Aug 8, 2003
Loading...

Share This Page