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 12 of 12
  1. #1
    New Coder
    Join Date
    Nov 2007
    Location
    Sydney, Australia
    Posts
    19
    Thanks
    2
    Thanked 0 Times in 0 Posts

    need to save time

    I need to make it so that top half the page which includes the menus
    and few things that will be changed often to be separate to the rest of the page.

    So what i mean is when someone clicks the links on the top half of the page within the banner etc only the bottom half of the page changes.

    I want this so i can edit the top page adding and deleting links etc without having to do it to every single page.

    Can someone link me or explain the easiest way to do this.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Write the code for your navigation in a separate file and by using some server side script, include them wherever required.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Jul 2007
    Posts
    571
    Thanks
    25
    Thanked 28 Times in 28 Posts
    This is easy. It requries PHP but nothing hard. Just make sure your web host supports PHP. If not you will need to use wtv language they support.

    What to do:

    1) Copy paste the "Header" code from the orginal file and put it in a new file and name it "header.php".
    2) Delete the "header code" from the original file and replace it with
    PHP Code:
    <?php
    include (header.php);
    ?>
    3) Re-save this file as a php file (not html).

    Now you header is in one file :-)

    To make it easier to manage I would make an "includes folder" with all the stuff u include, ex: header, footer, sidebar, ext...

  • #4
    Senior Coder
    Join Date
    Jan 2005
    Location
    Memphis, TN
    Posts
    1,785
    Thanks
    8
    Thanked 131 Times in 129 Posts
    to piggy back on sRule you can do this in Cold Fusion, ASP and .NET as well:

    ASP
    Code:
    <!--#include file="header.asp"-->
    .NET
    Code:
    <!--#include file="header.aspx"-->
    Cold Fusion
    Code:
    <cfinclude template = "header.cfm">
    that is if your site is not PHP.
    Stop making things so hard on yourself.
    i is tugbucket :: help raise tugburg :: Whitehaven Kiwanis

  • #5
    New Coder
    Join Date
    Nov 2007
    Location
    Sydney, Australia
    Posts
    19
    Thanks
    2
    Thanked 0 Times in 0 Posts
    i had a go doing it. using ssi

    saved the page as pagename.shtml

    and put the code

    <!--#include virtual="header.html"-->

    didn't seem to get the result i wanted.
    will attempt the php way

  • #6
    New Coder
    Join Date
    Nov 2007
    Location
    Sydney, Australia
    Posts
    19
    Thanks
    2
    Thanked 0 Times in 0 Posts
    okay i got a problem

    i get this error on my page were the header is meant to be

    Code:
    Warning: main(headerphp): failed to open stream: No such file or directory in /hsphere/local/home/alexin11/moreleadsandcustomers.com/contactus.php on line 111
    
    Warning: main(headerphp): failed to open stream: No such file or directory in /hsphere/local/home/alexin11/moreleadsandcustomers.com/contactus.php on line 111
    
    Warning: main(headerphp): failed to open stream: No such file or directory in /hsphere/local/home/alexin11/moreleadsandcustomers.com/contactus.php on line 111
    
    Warning: main(): Failed opening 'headerphp' for inclusion (include_path='.:/usr/local/lib/php:/usr/local/share/pear') in /hsphere/local/home/alexin11/moreleadsandcustomers.com/contactus.php on line 111

  • #7
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,639
    Thanks
    6
    Thanked 1,004 Times in 977 Posts
    Obviously the file you’re trying to include is missing (i.e. not uploaded?) or the path is incorrect.

  • #8
    New Coder
    Join Date
    Nov 2007
    Location
    Sydney, Australia
    Posts
    19
    Thanks
    2
    Thanked 0 Times in 0 Posts
    but the header.php is in the same directory?

  • #9
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Lol, its header.php not headerphp, an innocent message from parser!
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #10
    New Coder
    Join Date
    Nov 2007
    Location
    Sydney, Australia
    Posts
    19
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I have put

    <?php
    include (header.php);
    ?>

  • #11
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You need the quotes
    PHP Code:
     <?php
    include ('header.php');
    ?>
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #12
    New Coder
    Join Date
    Nov 2007
    Location
    Sydney, Australia
    Posts
    19
    Thanks
    2
    Thanked 0 Times in 0 Posts
    worked. thank you !


  •  

    Posting Permissions

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