Welcome to Welcome to DNF.com™ - Domain Sales, Domain Forum, Domain Appraisals, Domain Registrars

If you are new to domains and looking to buy, sell and learn about domains then you have come to the right place. DNForum is the largest domain name community on the internet and continues to grow every day. There are over 105,000 domainers on DNForum doing everything from buying domains, selling domains, learning about domains and discussing domains. Take a minute and Register.

Register Today on DNForum IT'S FREE!

Results 1 to 10 of 10
  1. #1
    DNF Member

    Join Date
    Mar 2004
    Location
    Boston, MA
    Posts
    408
    DNF$
    2,018
    Bank
    0
    Total DNF$
    2,018
    Donate  

    HTML/PHP advice needed.

    I am wondering, what is the best way to design a website that has some areas of static content that show up on each page such as a site navigation menu or a page footer that contains a disclaimer and links? The information on the menu and footer would never change from page to page, only the rest of the page content.

    From my understanding, I want to stay away from frames. So how would I go about doing this? Should I put the menu and footer in spererate php files and use includes on each page to call them in? Or is there another way to go about this. I just want to make sure I get most of this right so I don't have to 1 day open up 500 files just to make a minor change to the dislaimer or copyright info on each page.

    Your help is greatly appreciated. Example are helpful if possible. Thanks.
    WorldNewsForum.com - General Discussion Forum
    FightForum.com - MMA, Boxing, UFC, and More - Discuss Boxing and MMA.

  2. #2
    DNF Regular
    DNGeeks's Avatar
    Join Date
    Jan 2005
    Location
    Winnipeg Canada
    Posts
    625
    Country

    Canada
    DNF$
    10,257
    Bank
    0
    Total DNF$
    10,257
    Donate  

    Re: HTML/PHP advice needed.

    Php includes for the header and footer are probably your easiest and fastest way to get this job done. You could have a 50,000 page site, 1 header, 1 footer and it's simple to change the layout/menu once and be done with it.

    An example page is below. Page is named index.php

    <!DOCTYPE><html><head><title>title goes here</title>
    <? include('head.txt') ?>

    put your body html here

    <? include('foot.txt') ?>


    head.txt would just contain the rest of your header, the main menu and opening tables etc.

    foot.txt would contain the closing tables and bottom of your page.

  3. #3
    DNF Member

    Join Date
    Mar 2004
    Location
    Boston, MA
    Posts
    408
    DNF$
    2,018
    Bank
    0
    Total DNF$
    2,018
    Donate  

    Re: HTML/PHP advice needed.

    Thanks for the reply. I was thinking along those line but just wasn't sure. I guess I am confident enough to go mess around with it now. Wish me luck =)
    WorldNewsForum.com - General Discussion Forum
    FightForum.com - MMA, Boxing, UFC, and More - Discuss Boxing and MMA.

  4. #4
    DNF Regular
    DNGeeks's Avatar
    Join Date
    Jan 2005
    Location
    Winnipeg Canada
    Posts
    625
    Country

    Canada
    DNF$
    10,257
    Bank
    0
    Total DNF$
    10,257
    Donate  

    Re: HTML/PHP advice needed.

    Good luck

    One thing you may need to know, depending on your system you may have to include the path to the include. Try not to use the URL to the include however even though that may be easier. /home/username/public_html/folder/head.txt (or whatever your path is) is the best.

  5. #5
    Platinum Lifetime Member
    C0113c70r's Avatar
    Join Date
    Sep 2003
    Location
    Mobile, AL (USA)
    Posts
    127
    DNF$
    968
    Bank
    0
    Total DNF$
    968
    Donate  

    Re: HTML/PHP advice needed.

    The first time I ever tried to create repeating elements in a web site, I really screwed up and used a JavaScript file. Since learning a bit of PHP, I'll never go back to the old way of doing things again.

    Good luck.

    --- C0113c70r

  6. #6
    Platinum Lifetime Member
    Darren06's Avatar
    Join Date
    Sep 2003
    Location
    California, US
    Posts
    1,911
    Country

    United States
    DNF$
    3,298
    Bank
    0
    Total DNF$
    3,298
    Donate  

    Re: HTML/PHP advice needed.

    Hi, I suggest using
    <?php
    include "file.php";
    ?>
    instead as ) is not really needed.

  7. #7
    Platinum Lifetime Member

    Join Date
    Feb 2005
    Posts
    44
    DNF$
    332
    Bank
    0
    Total DNF$
    332
    Donate  

    Re: HTML/PHP advice needed.

    Include is definately the simplest, you could do a SSI if you have no other need for php.
    A simple template engine is also an option, if you want to generate static pages

  8. #8
    Platinum Lifetime Member
    mikesherov's Avatar
    Join Date
    Jan 2005
    Location
    NY
    Posts
    463
    DNF$
    2,086
    Bank
    0
    Total DNF$
    2,086
    Donate  

    Re: HTML/PHP advice needed.

    imho, the best way to have a PHP template so to speak is to make your repeatable page... name it "template.htm", and put "##content##" where you want the changing content to be.... then you can make each individual page as another file "aboutus.htm". Then on a PHP page you can do this:

    <?
    echo str_replace('##content##',file_get_contents('about us.htm'),file_get_contents('template.htm');
    ?>
    Viola... PHP (in 1 line) has now sucked the aboutus page into the space where ##content## is on the template page. You have now taken your first step towards proper templating and seperating your code from your design.

  9. #9
    MomsDigest.com For Sale!
    cursal's Avatar
    Join Date
    Aug 2003
    Location
    Oregon
    Posts
    1,839
    DNF$
    16,559
    Bank
    0
    Total DNF$
    16,559
    Donate  

    Re: HTML/PHP advice needed.

    NIce tip mike, thanks

  10. #10
    Platinum Lifetime Member
    Darren06's Avatar
    Join Date
    Sep 2003
    Location
    California, US
    Posts
    1,911
    Country

    United States
    DNF$
    3,298
    Bank
    0
    Total DNF$
    3,298
    Donate  

    Re: HTML/PHP advice needed.

    Ah mike that is not really a good way... just make it use an OOP template parser...

Similar Threads

  1. Advice Needed - Been contacted by PI Firm
    By siaver in forum Domain Name Appraisal Discussion
    Replies: 29
    Last Post: 04-19-2005, 08:30 PM
  2. How to protect your claim to domains? Advice needed! URGENT!
    By Collector in forum Domain Name Legal Issues
    Replies: 5
    Last Post: 11-26-2004, 08:48 AM
  3. Used a copyrighted image :-( advice needed if possible
    By laskos in forum Domain Name Legal Issues
    Replies: 21
    Last Post: 04-03-2004, 09:16 AM
  4. Proper Sound Advice Needed About .ltd.uk's
    By DRPiNG in forum Domain Name Appraisal Discussion
    Replies: 2
    Last Post: 10-11-2002, 06:49 AM

Bookmarks

Posting Permissions

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

Domain name forum recommended by Domaining.com