Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Oct 2002
    Location
    USA
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question can PHP be a solution?

    my website is growing day by day with new pages.

    I am not using any frames on it, and so I have to insert the same header, footer and the menu to each page.

    when I am making a change it is becoming more of a trouble day by day - since I am not using a content management system like phpnuke or so.

    is it possible that I write just one, shall we say, menu/header/footer script, and apply it to all pages by simply referencing to it?

    can php do that?

    if not, what else can you recommend?

    thanks!

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    You can do this by using includes

    example
    header.php
    PHP Code:
    <html>
    <
    head>
    <
    title>Website name</title>
    </
    head>
    <
    body
    footer.php
    PHP Code:
    <p>Footer text</p>
    </
    body>
    </
    html
    index.php
    PHP Code:
    <?php
    include("header.php");
    ?>
    This text is now in the body
    <?
    include("footer.php");
    ?>

  • #3
    Regular Coder
    Join Date
    Oct 2002
    Location
    USA
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks for the reply.

    to give it a bit of depth:

    I will put them in tables of a regular .html file.

    So, if my menu.php file itself is actually a table with a width of 90%, will I have to make any modifications?

    Thanks!

  • #4
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    If your html was fine before, then you shouldn't have to change anything

  • #5
    Regular Coder
    Join Date
    Oct 2002
    Location
    USA
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks a lot for your time.

    One last question: is php the only option or could this be done by other term in html?

    Thanks.

  • #6
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    In html, you could use iframes, can't think of any other way

  • #7
    Regular Coder
    Join Date
    Oct 2002
    Location
    USA
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I did it all and it works great!

    Thanks a lot!

  • #8
    Regular Coder
    Join Date
    May 2002
    Location
    Virginia, USA
    Posts
    621
    Thanks
    0
    Thanked 6 Times in 6 Posts
    A non-php method = server side includes! (SSI):

    <!--#include file="header.htm" //-->


  •  

    Posting Permissions

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