any probs having most pages end .php?

Discussion in 'Web Design and Development' started by eclipse, Mar 30, 2008.

  1. eclipse macrumors 6502a

    eclipse

    Joined:
    Nov 18, 2005
    Location:
    Sydney
    #1
    Hi all,
    I'm using Kompozer at the moment and to replace the "Components" function of GoLive (which I found destroyed the code worse than Kompozer) I am using php scripts. This is so that I can design a php include page for my menus, and if I have to just edit the MENU navigation bar page rather than ALL the pages on my website. Something to experiment with anyway.

    So.... are there side effects having all web-pages end in .php instead of html? Are there browsers that have more trouble with this? Thanks.
     
  2. notnek macrumors 6502

    notnek

    Joined:
    Oct 25, 2007
    #2
    All of my pages have a .php extension. Most include php script, but some don't. I've never had a problem.
     
  3. Herodotis macrumors newbie

    Joined:
    Mar 6, 2008
    #3
    Parse the .html pages

    Hi eclipse,

    I use php ssi's on my website for the Nav pane as well as header and footer sections but I kept the .html page endings instead of changing them all to .php.

    I added the following Apache Handler that made the server parse the .html pages. Easier than renaming files.

    AddHandler server-parsed .shtml

    I don't know if this will work in your case but hopefully someone with more experience will post more.

    I can't think of any side effects.

    Cheers
     
  4. notnek macrumors 6502

    notnek

    Joined:
    Oct 25, 2007
    #4
    Name your page something.php

    <?php

    include(header.php);
    include(nav.php);
    include(footer.php);

    ?>

    and so on.... Whatever constants you want displayed on every page.
     
  5. eclipse thread starter macrumors 6502a

    eclipse

    Joined:
    Nov 18, 2005
    Location:
    Sydney
    #5
    OK Notnek, but does doing that place them all together? ? What code do I need on the include pages to tell the headers and footers where to go, if you see what I mean? I thought the PHP script had to be put on the page where you actually wanted them to show up, not bunched up together?
     
  6. notnek macrumors 6502

    notnek

    Joined:
    Oct 25, 2007
    #6
    Turns out, I was wrong. I got out a trusting book and found the right answer. I'll just explain how to do it for your menu.

    Create a file named navigation.inc

    In this file, treat it as any html page. Layout your divs, content, css, whatever. But just your menu code.

    In your regular pages (something.php), where you're menu would go:

    <?php require('navigation.inc'); ?>

    That will output the menu that you created in navigation.inc



    If you want to have every section of your page like this, just create more pages like header.inc and footer.inc. Then the format of your site will be consistent and when you want to change something, you just have to edit one file rather than all of them.


    I hope this helps. Sorry for being wrong and confusing earlier!
     
  7. eclipse thread starter macrumors 6502a

    eclipse

    Joined:
    Nov 18, 2005
    Location:
    Sydney
    #7
    Oh? I thought the code was...

    <?php include("myinclude.php") ?>

    It works for me... you can see at this page the only thing I actually had really on this page was the title in bold, everything else comes from my test menu php page.

    (Just very basic for testing purposes).

    The php code has gone invisible though... it used to be pink!

    http://lanksheardesign.com/folio-books.php
     
  8. notnek macrumors 6502

    notnek

    Joined:
    Oct 25, 2007
    #8
    That works. PHP will be invisible in the source and on the page. That's one thing that makes it great. As long as you're getting the content from the include file, then it's correct. Good luck with the rest of your project. If you need any help with more stuff, just PM me.
     

Share This Page