I would like to have one menu that is used on 30 pages. I have built the meny with css/html. I only know html as far as page construction goes. Is it possible to "call" the menu with a line of code in html?

Recommended Answers

All 4 Replies

If you don't already have the other pages built and edited use your initial page as a template of sorts.
Then everything is standardized that you need to be.

Also copy paste works great and takes about 2 seconds ;)
Think of it this way... you're still going to have to copy paste the script

I'm not certain though if you can call a nav bar. I'm sure its possible through a script, but I'm just getting back into everything and am relearning myself.
Personally the template is the best way to go though.

Thank you for your answer. Not sure if it's the way to go though. Updating a template isn't going to update all the pages, so they'll still have to be done one by one. Thanks anyway though.

You could use any server side language for this. For example, you could change the extension of your pages to php and write this: <?php include 'menu.php'; ?> Where menu.php contains the menu (duh).

You could also do it the other way around, put the menu in index.php and include a page that contains the text.

Landscape all you have to do is put your css for the navigation menu into an external css file and link it in the webpage:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="http://www.example.com/css/nav.css">

<!-- rest of html page-->

replace example.com with your website address (this has to be an absolute path because relative paths do not work in css for linking for whatever reason) and then create a css folder. Next make the nav.css file and place your navigation menu css code from your web page into it.

Add the above link code and you are good to go. All you need to do is replace all of the nav menu css in your pages with that link and it will add your navigation menu.

Please note that you will still need the html code that implements the css and if you have any additional css code besides the stuff for your navigation menu it will also need to be moved to either the nav file or a different .css file as you can not use links and the style tags at the same time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.