What is this web dev term called

Discussion in 'HTML & Website Design' started by krebs, Sep 27, 2009.

  1. #1
    And how do I do it?

    I am working on a website which I need to have a menu. I really dont want to update every html page for each time I update or change the menu. Is there a way I can change the menu once and have that be reflected on all of the pages which have that menu?

    In the past I used frames but would like to use something more efficient. I only know html and use dreamweaver.

    Gosh, I hope this question isnt too "beginner" for this board.

    Thanks in advance for your help
     
    krebs, Sep 27, 2009 IP
  2. instant87

    instant87 Active Member

    Messages:
    626
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    80
    #2
    You can use the <iframe> tag and just have your menu on a single .html page.

    If you want to go more advanced, you can use the include tag in php (which is more common), but you would have to learn basic php programming to do it. It's worth it in the long run.
     
    instant87, Sep 27, 2009 IP
  3. TechnoGeek

    TechnoGeek Peon

    Messages:
    258
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I agree with instant87. You should learn PHP and you will be able to do menu inclusions and many other things. Anyway, you will sooner or later have to learn PHP. The sooner, the better.
     
    TechnoGeek, Sep 27, 2009 IP
  4. jonbuoy

    jonbuoy Peon

    Messages:
    284
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Agree with the other replies that a php include is the way to go.

    Really simple once you've got the hang of it and quick to amend multiple pages.
     
    jonbuoy, Sep 28, 2009 IP
  5. krebs

    krebs Greenhorn

    Messages:
    44
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #5
    Is there a good resource for learning PHP which one of you could recommend?

    Perhaps a beginners book(PHP For dummies?) or website would be very helpful.

    Thanks again, this is a huge help.
     
    krebs, Oct 1, 2009 IP
  6. krebs

    krebs Greenhorn

    Messages:
    44
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #6
    Also, what are the SEO implications? Is PHP good for SEO?
     
    krebs, Oct 1, 2009 IP
  7. jonnyshaw89

    jonnyshaw89 Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    this is called a server side include (SSI)
     
    jonnyshaw89, Oct 1, 2009 IP
  8. feeling88

    feeling88 Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    PHP > inclusions

    really helpful , no time consuming and no headache
     
    feeling88, Oct 1, 2009 IP
  9. myst_dg

    myst_dg Active Member

    Messages:
    224
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    58
    #9
    When someone's visiting the PHP file, it will be compiled into HTML from the server side. So it's not PHP's fault if you got something shitty with SEO.
     
    myst_dg, Oct 2, 2009 IP
  10. Kerosene

    Kerosene Alpha & Omega™ Staff

    Messages:
    11,366
    Likes Received:
    575
    Best Answers:
    4
    Trophy Points:
    385
    #10
    Everything that PHP does happens on the server, so by the time it gets to the spiders, bots, and end users, it may as well be a static page that you've typed out yourself. If YOU write your PHP to output SEO'd content, then that's what everyone will see.

    As everyone else had said, PHP include is the way to go for your menus.
    http://www.php.net/function.include

    The online PHP manual is a great place to start learning about PHP. It looks intimidating at first (and it is!), but once it "clicks", then you'll be hooked.
    http://www.php.net/manual/en/index.php

    You can learn PHP on your own computer by installing Apache/PHP locally using something like XAMPP.

    PHP is worth every second you spend learning about it :) :)
     
    Kerosene, Oct 2, 2009 IP
  11. k998

    k998 Member

    Messages:
    34
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #11
    In Dreamweaver, they have what they call Library items. You code the Library item and then apply it to each page. If you need to make a change, update the library item and when you save it, DW prompts 'update all pages', click yes and you're done!

    Depending on your site, you may not need to go down the track of PHP, etc.
     
    k998, Oct 2, 2009 IP
  12. Chaps

    Chaps Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Put your menu code in a separate file called 'menu.php' or whatever.

    Then where the menu is supposed to appear in your pages put in:

    <?php include("menu.php"); ?>

    Make sure each page is renamed to page.php and not page.html.

    It's as simple as that.
     
    Chaps, Oct 2, 2009 IP
  13. krebs

    krebs Greenhorn

    Messages:
    44
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #13
    The throbbing brain that is DP forums has once again helped immensely. Thank you all for the insight.

    Cheers!
     
    krebs, Oct 2, 2009 IP
    Kerosene likes this.
  14. krebs

    krebs Greenhorn

    Messages:
    44
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #14
    Thanks again everyone for the great responses. I tried to get this and I am hung up on one thing. When I insert the php code:
    <?php include("menu.php"); ?>

    it destroys my layout. Currently I use tables to organize the page but when the PHP menu is put in, the tables go away and are replaced by the new PHP menu file and only a bit of unformatted text from that page.

    Why might this be?

    I cant find the answer anywhere so it must be so easy that no one had to ask it online.
    Thanks in advance.
     
    krebs, Oct 27, 2009 IP
  15. Kerosene

    Kerosene Alpha & Omega™ Staff

    Messages:
    11,366
    Likes Received:
    575
    Best Answers:
    4
    Trophy Points:
    385
    #15
    If you manually copy and paste the code from menu.php into your page (replacing your current php includes line), is it still broken?
     
    Kerosene, Oct 27, 2009 IP
  16. krebs

    krebs Greenhorn

    Messages:
    44
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #16
    Yes, when I either type or paste that code into my new .php page it is not showing correctly. "menu.php" file does show up correctly, but it destroys my current layout and actually removes most of the content on that page. When I place the php code outside of the main table it does show up however.

    Does PHP not work well with tables? I hate to say it but I am rather new to this. I hear tables are a hassle but that is the best way I have found to lay out my content.

    Thanks in advance
     
    krebs, Oct 28, 2009 IP
  17. krebs

    krebs Greenhorn

    Messages:
    44
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #17
    Alright, I got it working now. Wow, this totally rocks and will certainly save me time.

    Thanks again to all for your help along the way. ;)
     
    krebs, Oct 30, 2009 IP