1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Why should i create dynamic Header & footer? (New to PHP)

Discussion in 'PHP' started by imza86, Apr 26, 2016.

  1. #1
    Hi, i have been going through this PHP tutorial course. Normally i have been creating website in HTML and CSS format.

    So this tutorial shows you how to create dynamic header and footer.

    But my questions is why would you want to do that ?
     
    imza86, Apr 26, 2016 IP
  2. Anveto

    Anveto Well-Known Member

    Messages:
    697
    Likes Received:
    40
    Best Answers:
    19
    Trophy Points:
    195
    #2
    It lets you reuse your code and makes it easier to update your code. Let's say you want to make a 5 page website with navigation in the header and footer. You make the page and show your client and he says "add another page". If you made the site in html you would have to update all 5 pages and the 6 page to change the navigation. But with a header and footer file you only have to make the change in two places and it updates on all pages.

    Edit: to add to that, you could do the same thing with anything that is reused on multiple areas of the site such as a sidebar or a login window.
     
    Anveto, Apr 26, 2016 IP
    sarahk likes this.
  3. cerahil

    cerahil Well-Known Member

    Messages:
    72
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    113
    #3
    Agreed with Anveto..
     
    cerahil, Apr 26, 2016 IP
  4. karjen

    karjen Active Member

    Messages:
    54
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    73
    #4
    and inorder for your footer and header to be dynamic, all your files should be in .php
     
    karjen, Apr 30, 2016 IP
  5. lektrikpuke

    lektrikpuke Well-Known Member

    Messages:
    297
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    113
    #5
    PHP is my favorite, but really any scripting language will make your life easier (especially in the long run). When you say 'why,' I will answer your question with a question. Why use CSS (preferably in a style sheet and not on-page, in-line)? Also, do you want your navigation to have exactly the same links and look on every page, regardless of the user? Scripting (server-side and client-side) makes your life easier, more productive.
     
    lektrikpuke, Apr 30, 2016 IP