General PHP question

Discussion in 'Web Design and Development' started by ercw, Jun 2, 2006.

  1. ercw macrumors regular

    Joined:
    May 4, 2006
    #1
    So I know the benefits of php as far as what it can do to sites with databases.
    I also know that it can parse input information in a page such as calculations, password protection, Email forms etc...

    My question is: How can PHP be useful on a design stand point alone.
    Any benefits in creating a non-database site with PHP?
     
  2. AmbitiousLemon Moderator emeritus

    AmbitiousLemon

    Joined:
    Nov 28, 2001
    Location:
    down in Fraggle Rock
    #2
    templating.

    By using simple includes you can have your header, footer, and other parts of the site that get called often in separate files so that you change it in one place and it changes on all your pages that use it. It also keeps your design simpler since you are not duplicating code. Write it once.
     
  3. ercw thread starter macrumors regular

    Joined:
    May 4, 2006
    #3

    Right. I already use HTML includes for that purpose. are PHP includes better?
     
  4. dornoforpyros macrumors 68040

    dornoforpyros

    Joined:
    Oct 19, 2004
    Location:
    Calgary, AB
    #4

    Yup, at the previous company I was with we used PHP to load a different CSS file dependent on which client was logged into our back end system. The client logs in and sees their logo & colours when editing their site, it was pretty spiffy before our employer bastardized it...not that I'm bitter...
     
  5. thejadedmonkey macrumors 604

    thejadedmonkey

    Joined:
    May 28, 2005
    Location:
    Pa
    #5
    What are HTML includes?
     
  6. DavidLeblond macrumors 68020

    DavidLeblond

    Joined:
    Jan 6, 2004
    Location:
    Raleigh, NC
    #6
    I'm guessing he means SSI includes, right? With PHP includes you can have more control. Say there is a small difference with your footer on your front page than on all the other pages. You can stick an if statement in the footer to make the change for that single page. Or in the nav bar so you can't click on "Home" when you're actually on the Home page. Stuff like that.
     
  7. ercw thread starter macrumors regular

    Joined:
    May 4, 2006
    #7

    Sorry, I meant SSI includes
     
  8. ercw thread starter macrumors regular

    Joined:
    May 4, 2006
    #8
    Sorry, I did mean SSI. (I'm just an old fart)
    Do you know of any good sources or example codes for this subject?
    Thank you
     
  9. Mitthrawnuruodo Moderator emeritus

    Mitthrawnuruodo

    Joined:
    Mar 10, 2004
    Location:
    Bergen, Norway
    #9
    There are quite a lot of small examples at php.net (include).
     
  10. Moria macrumors regular

    Joined:
    May 7, 2005
    Location:
    Glasgow, Scotland
    #10
    PHP:
    <?
    include(
    "includefile.ext");
    ?>
    That will include a file
     
  11. mnkeybsness macrumors 68030

    mnkeybsness

    Joined:
    Jun 25, 2001
    Location:
    Moneyapolis, Minnesota
    #11
    There are some great templating systems out there, but my favorite has to be Templation. Written by a previous boss of mine, we used it on a very large site. It's lightweight and extremely fast... oh, and free.
     

Share This Page