A better way putting a menu bar, on every page

This is a discussion on "A better way putting a menu bar, on every page" within the Web Page Design section. This forum, and the thread "A better way putting a menu bar, on every page are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Oct 14th, 2006, 14:13
Junior Member
Join Date: Aug 2006
Location: UK Sussex
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
A better way putting a menu bar, on every page

Hi sorry for the noob question again.

I have been working on large website, lots of pages. It looks great, i'm pleased with the design, but I feel I could be doing things a bit more effectively.

For example I have a side menu, with about 8 links in it created from splitting the cell.
However I was wondering if there is a way of doing the menu just once, then linking it to all the pages, so if I need to add a new link I don’t have to edit all the pages. I know it can be done, with framesets, but would like to avoid this if possible.

If I have a menu on its own, can it be saved and then linked,to the other pages?



Thank you

Last edited by Joolsd186; Oct 14th, 2006 at 14:20.
Reply With Quote

  #2 (permalink)  
Old Oct 14th, 2006, 14:56
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: A better way putting a menu bar, on every page

Can you just copy the table or cells and then paste it into the new page?
Or you could make up a template of the first page and just use the template to make up the new pages.
Reply With Quote
  #3 (permalink)  
Old Oct 14th, 2006, 16:40
Junior Member
Join Date: Aug 2006
Location: UK Sussex
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: A better way putting a menu bar, on every page

Hi thanks for the reply

The way you said is exactly what I have done. When I first started the site, I was very careful to make sure that all the links were placed in. However the peoples whos web page it is, want to put another link in. Ouch! hehehe!


Etheir way i am going to have to open each page and paste or duplicate (as you said) the new link in one way or another. I was just thinking in the long term, was there a better way of setting up the page, so now, there is an amendment, it only will take 30 seconds to do instead of an hour.

The website must not for techical reasons use frames. The only good thing about frames was the ease of which the one menu html was editable. Do you see what I mean?

I throught I remebered seeing sombody do this with a normal html page, but maybe I dreamt it lols.

Last edited by Joolsd186; Oct 14th, 2006 at 16:59.
Reply With Quote
  #4 (permalink)  
Old Oct 14th, 2006, 19:48
Highly Reputable Member
Join Date: Jul 2005
Location: Northampton, England
Age: 19
Posts: 506
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to bruno89
Re: A better way putting a menu bar, on every page

lol iv bin looking for the same thing i havnt found anything as yet tho iv only bin lookin for a few days tho if i find anything ill tell you mate
Reply With Quote
  #5 (permalink)  
Old Oct 14th, 2006, 20:00
Junior Member
Join Date: Aug 2006
Location: UK Sussex
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: A better way putting a menu bar, on every page

After a lot of googleing I came across IFRAME tags. It looks promising in that it might save time.
Its a bit like a frame set but you can put it inside an ordinary page.

I have inserted a tag then it lets you choose the iframe option, then you can link to the menu.htm
The trouble with it is that you can't see it untill you preview the page.

I have seen it in use many times, but haven't really used it at all. Are there any problems with this device?
Reply With Quote
  #6 (permalink)  
Old Oct 15th, 2006, 01:24
Junior Member
Join Date: Aug 2006
Location: UK Sussex
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: A better way putting a menu bar, on every page

Before I get too pleased with myself, will the IFRAME hinder the seach engines? There are tags in the main index.htm, (noframes part of the code) the iframe is just an element on the page, so will, this affect the search?

Last edited by Joolsd186; Oct 15th, 2006 at 01:51.
Reply With Quote
  #7 (permalink)  
Old Oct 15th, 2006, 01:45
Ryan Fait's Avatar
SuperMember

SuperMember
Join Date: May 2006
Location: Las Vegas
Posts: 3,786
Thanks: 0
Thanked 0 Times in 0 Posts
Re: A better way putting a menu bar, on every page

Use PHP! It's definitely the best way of doing this.

First of all, you need to change all of the extensions from .html to .php. Then in, say, your main page, add this:

PHP: Select all

<html>
    <p>Content above your navigation</p>
<?php
include $_SERVER["DOCUMENT_ROOT"]."/path/to/menu.php";
?>
    <p>Content below your navigation</p>
</html>
Then this would be menu.php:

Code: Select all
<ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Contact Us</a></li>
</ul>
Reply With Quote
  #8 (permalink)  
Old Oct 15th, 2006, 05:07
Up'n'Coming Member
Join Date: Aug 2006
Location: Peru
Age: 21
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Re: A better way putting a menu bar, on every page

It can also be done with javascript. You'll have to write a .js document with the code that generates the menu, something like:
document.write("<ul><li><a href='#'>Home</a></li>");
document.write("<li><a href='#'>About</a></li>");
...
document.write("</ul>");

And then on evere page just add a line like this one where you want to place your menu: <script type="text/javascript" src="menu.js"></script>, where menu.js is the file where you put the code above.

It'd be helpful if you don't want to use a server side language like php or asp.
Reply With Quote
  #9 (permalink)  
Old Oct 15th, 2006, 08:54
Junior Member
Join Date: Aug 2006
Location: UK Sussex
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: A better way putting a menu bar, on every page

Thanks for the tips.

I have only done very basic java, and I haven't done any php. The site is nearly finished. If there is a tutorial I would like to have a look. I'm using dreamweaver, I have good graphic skill but not an as knoledgable as you guys, in notpad. My buttons light up and all that. I'm sure the way you said is probably better, but a step at a time.

The Iframes seem to be working, Its just a element in the page. But would this hinder any of the searching on the content pages?

Reply With Quote
  #10 (permalink)  
Old Oct 15th, 2006, 09:34
Reputable Member
Join Date: Dec 2005
Location: Bristol
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to crewdesign
Re: A better way putting a menu bar, on every page

no do what ryan said and use php, its realy simple, just as simple as IFRAMES.
<?php include ("nav.htm"); ?> and then nav.htm would be the same as ryans. All you have to do is then stick that code on every page and whenever you want to add a link you just change nav.htm

Last edited by crewdesign; Oct 15th, 2006 at 09:39. Reason: forgot the ";"
Reply With Quote
  #11 (permalink)  
Old Oct 15th, 2006, 09:40
Reputable Member
Join Date: Dec 2005
Location: Bristol
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to crewdesign
Re: A better way putting a menu bar, on every page

Yes it would, search engines will not be able to read your navigation meaning they wont be able to visit all your other pages, so they will get to the homepage but will have difficulty following the links to index the rest of your pages
Reply With Quote
  #12 (permalink)  
Old Oct 15th, 2006, 10:52
Junior Member
Join Date: Aug 2006
Location: UK Sussex
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: A better way putting a menu bar, on every page

Quote:
First of all, you need to change all of the extensions from .html to .php. Then in, say, your main page, add this:
Ok this is interesting, with the menu.htm, I change this to
menu.php and would place it in my root folder? I do not have any server access, the thing is handed over to another person


Quote:
<html>
<p>Content above your navigation</p>
<?php
include $_SERVER["DOCUMENT_ROOT"]."/path/to/menu.php";
?>
<p>Content below your navigation</p>
</html>
I see the above and below <p> tags. It kind of makes sense.
My navigation page has a specific size, where would the sizeing take place. Will the role overs work in the same way? When I have produced the menu, how would I manipulate it in dream weaver? It is a dream weaver job. I would have to place the code in the code view.

I will be back later to night, to try it out, will probably have questions.

Last edited by Joolsd186; Oct 15th, 2006 at 10:57.
Reply With Quote
  #13 (permalink)  
Old Oct 15th, 2006, 16:49
Reputable Member
Join Date: Dec 2005
Location: Bristol
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to crewdesign
Re: A better way putting a menu bar, on every page

Because php is a server side language, it will include your menu file e.g: <a href="#">page</a>, before the user sees it so in effect the html code will just be <p>Page Here</p><a href="#">Page</a> and so all the styling will be done after just like anormal page
Reply With Quote
  #14 (permalink)  
Old Oct 15th, 2006, 18:48
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: A better way putting a menu bar, on every page

The way to approach this sort of thing is to structure your page layout in the normal way. Then decide which part(s), this will usually be section(s) defined by a <div> element are going to be the same from page to page.

Place each of these in its own file. I name mine 'navigation.inc' and so on. These can then be called into your pages using for example php as shown below;
Code: Select all
<?php
   include ('navigation.inc');
?>
Styling associated with the contained elements and their position on the page are handled by your stylesheet(s) in the normal way.

Your pages do not, necessarily, have to have the .php extention in order for them to be processed correctly. They can have the normal extention of .html and an instruction in your servers .htaccess file ensures they are processed for any php code they may contain. This is in fact my preferred method.

The line required in your .htaccess file is shown below;
Code: Select all
AddType application/x-httpd-php .html .php4 .shtml .txt
This is telling the server to process any files with these extentions for php code.
Reply With Quote
  #15 (permalink)  
Old Oct 15th, 2006, 19:49
Junior Member
Join Date: Aug 2006
Location: UK Sussex
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: A better way putting a menu bar, on every page

Before I go down this road, is there anything which could be fixed with iframes

Please look at this thread?

http://www.htmlcodetutorial.com/help...t=2317&start=0
Reply With Quote
  #16 (permalink)  
Old Oct 15th, 2006, 21:41
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: A better way putting a menu bar, on every page

You don't want to go down the iframe route, they have a different purpose altogether.
Reply With Quote
  #17 (permalink)  
Old Oct 15th, 2006, 22:39
Junior Member
Join Date: Aug 2006
Location: UK Sussex
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: A better way putting a menu bar, on every page

I need a very simple beginners tutorial.

I tried to place the sample code in the correct place. The browser alerted me of a PHP server option, so it was in use. I tried to link to a menu.psp and name my index.psp. But I could not see the menu in the page, when I previewed the page.

I just need to look ultra basic website (3 pages maybe), which uses this method. For example a basic index.psp page, with the script in use, and a ultra basic menu.psp, I am eager to see where it is placed on the page. Also knowing the file structure of the ROOT folder would be nice to know?

Unfortunanly, have only a very basic understanding of code structure, at the moment. From what you are say it would be a bad idea to use iframes, so I will not use it. Also other forums do not recomend it.
Reply With Quote
  #18 (permalink)  
Old Oct 16th, 2006, 11:23
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: A better way putting a menu bar, on every page

Why don't you start with the two tutorials available through the stick at the top of the css forum.

There is one that gives you layout templates as a starting point for a web site with information on what goes where and why.

Then there is one that will show you how to build css driven menu systems.

For a good grounding in all the different (x)html tags (elements) and how to use them, try this site:
http://www.w3schools.com/tags/
Reply With Quote
  #19 (permalink)  
Old Oct 16th, 2006, 11:46
Junior Member
Join Date: Aug 2006
Location: UK Sussex
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: A better way putting a menu bar, on every page

Thank you I will look at those
Reply With Quote
  #20 (permalink)  
Old Oct 16th, 2006, 11:55
Junior Member
Join Date: Jun 2005
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Re: A better way putting a menu bar, on every page

Try here too... very good place.. I've been learning new stuff I didnt even realise existed in CSS... waaaaaay coool

http://www.html.net/
Reply With Quote
Reply

Tags
every, linking, menu, page effectivley

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Putting C# into an ASP.NET Page. alexgeek ASP.NET Forum 2 Feb 5th, 2008 17:16
need help putting a video on web page.... earl080688 Flash & Multimedia Forum 1 Oct 10th, 2007 04:04
Putting css in an html page. masonbarge Web Page Design 27 Feb 7th, 2007 22:28
putting music on a web page Dr. J Introduce Yourself 3 Aug 19th, 2005 20:59
Putting PHP in your web page Jodi PHP Forum 13 Jan 10th, 2005 20:50


All times are GMT. The time now is 09:14.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43