Jump to content

Recommended Posts

Posted

I've found some nice navigation menu's, but the problem i cannot get my head around is how do have the menu on everypage?

Its a horazontal menu, so first i thought how about a frame,so the top of the page does not change. Then a problem comes that when the menu expands its covered up by the other frame. I cannot put the code in the body of everypage as when i update a link on the menu i would have to change it on every page on the whole site.

 

How should i go about it?

Posted

You could use Server Side Includes or some easy PHP to just include some HTML in every page.

 

The PHP method is very simple if your web server supports it, most should do!

 

Change the extension of your page to .php and save the HTML that makes up your menu in a separate file (eg menu.txt).

 

In the page where you would like the menu to appear insert the following:

 

 include_once("path/to/menu.txt"); ?>

 

Upload your page and that should do it!

Posted
library element in dreamweaver works for me, add the menu to everypage and only have to edit one file - the library element, very similar to above php solution.
Posted
If you don't have anything server-side that supports this you could use JavaScript. The only disadvantage are the people who disable javascript.
Posted

I use this on my school website.

 

http://www.milonic.com/

 

You can use it for free or subscribe if you want. You just add code to each website and add a few files and away you go. Text file based admin too so its a piece of cake.

 

If this is of no use then please ignore everything I have just said and pretend I wasn't here.

Posted
You could use Server Side Includes or some easy PHP to just include some HTML in every page.

 

The PHP method is very simple if your web server supports it, most should do!

 

Change the extension of your page to .php and save the HTML that makes up your menu in a separate file (eg menu.txt).

 

In the page where you would like the menu to appear insert the following:

 

 include_once("path/to/menu.txt"); ?>

 

Upload your page and that should do it!

 

So lets say i'm using IIS6. All the

menu stuff save as .txt instead of a .htm file, then at the start of every web page i make put
 include_once("path/to/menu.txt"); ?>

and save as .php instead of .htm? Simple as that? I do not have to turn some settings on IIS on to allow PHP or somthing?

Posted

Ahh, you'll have to install PHP and set IIS up to use it, fairly simple though, have a look here.

 

Your

tag should stay in your main page, just put the HTML that actually makes up your menu into the includes file.

 

Depends on where you want your menu to appear, if you literally want it to be at the top of a page then yeah add the " include_once("path/to/menu.txt"); ?>" below your first

tag, if not add it inside whichever tag you want to place it by.

 

For example, I've added a menu inside a cell in a table so i've used the following code:

 

   
   
      include_once("includes/indexleftlinks.txt"); ?>

   

 

Remember to actually change "path/to/menu.txt" to whatever file you're including!

Posted

If you're using IIS you will have ASP (Active Server Pages) functionality which will allow includes. Name your pages with the .asp extension.

 

To run ASP includes, you simply need to do this:

 

page.html:


...





This is a web page. The menu should be above.

 

The important bit is the #include section.

Posted

If you're using dreamweaver you can use a template to accomplish this - add the menu to the template, apply the template to every page.. you only have to update the template menu and then reapply it to the pages when you need to make changes...

NVU also has a template function that looks similar to dw although I havn't used it myself yet....

Posted

Does this ASP thing make a meal out of style sheets? I have my menu.htm and my default.asp. Load either one (both have the same style sheet in use) and it looks as it should correct font sizes.

 

Merge them using the ASP thing and certain fonts go bold or bigger text. I do not understand why, as they are both using the same .css file! I've tried just have the menu.htm with a style sheet, just default.asp with a style sheet. Nothing seems to fix it.

 

As soon as i pop this code in the default.asp

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

both pages are in the right position, just not the right font sizes!

Posted

http://www.chesterton-high.net/new/default.asp is the "merged" page.

 

http://www.chesterton-high.net/new/menu.htm is the menu page by its self.

 

http://www.chesterton-high.net/new/defaultown.asp is identical to default.asp but without the first few lines of code out telling it to load menu.htm

 

If you load menu.htm or defaultown.asp they load as i want. Load the "merged" copy and some of the menu fonts go bigger and stuff.

 

I'm only playing with it at the moment, but i'm not going any further content wise until i can stop it changing the font!

Posted

That would be because the menu page includes the HTML tags, and then so does the main page so are conflicting.

 

As the menu is included in each page, it does not need the HTML tags for head, body, title, style etc - just the DIVs for the menu. :)

Posted

I'm being really thick here (HTML and Web stuff is not my speciality) but are HTML tags just anything in between and ?

 

So should i be modifying the menu or the default.asp?

Posted

In essence, an HTML tag (or "element") is a word enclosed in angled brackets.

 

The is just the starting tag saying that the document is an HTML page, and is ended with the tag.

 

Each page has a structure, basically:

 


...


...

 

Everything between the

and aren't displayed on the actual page, but can affect it's look and functionality (such as styles and title etc).

 

Since your pages already have the HTML tags in them, they shouldn't be declared again when you "include" the menu. All you are doing is injecting the contents of menu.html into the page when it is loaded.

 

As the menu doesn't need to be loaded on its own it doesn't need the HTML, head and body tags.

Posted

I wish I'd seen this thread a few months ago, or I'd started it. This is just what I need.

 

I manage a modest web site for our local CAMRA branch, but it's a real pain putting the same heading, menu and footer on each page and managing them. I always wondered how professionals did it. Viewing the code for others' pages just shows the one html file, like the menu had been put there manually.

 

I've just learnt CSS. Looks like it's time to start on PHP, and upgrade the hosting. :roll:

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...