Search code examples
htmlcssxmlmenu

How to repeat a menu without using iFrames or PHP in simple HTML/CSS or XML?


sorry for this ultimately newb question. I want to create a menu and not have to repeat the code of the menu on every single web page. I have done this with iframes in the past, but I know they aren't recommended. I have a pretty decent knowledge of HTML & CSS but I feel like I am missing something big here.

I am also not looking for the PHP solution which I believe is represented by:

<?php include("navigation.html"); ?>

Is there a good tutorial I can follow? I've heard this can be done with XML but I haven't been able to find what I am looking for exactly, and don't have any knowledge with it in the past.

In what I think is a related problem, I want to be able to place my google analytics code on just my index page and have it reference the entire website of pages, not just the index. Again, what am I missing here? Do I need to be using a content management system of some sort to pull off this slightly dynamic task? I don't think so...

Thanks for your help and please let me know if I can clarify my question any better!


Solution

  • Use server side includes as mentioned already. They are support by pretty much all major webservers so php is not even required.

    Check out the following articles:

    1. http://en.wikipedia.org/wiki/Server_Side_Includes
    2. http://httpd.apache.org/docs/1.3/howto/ssi.html (from apache, note no php needed)
    3. http://www.boutell.com/newfaq/creating/include.html

    Good Luck