Quackers Posted July 6, 2006 Posted July 6, 2006 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?
indie Posted July 6, 2006 Posted July 6, 2006 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!
danIT Posted July 6, 2006 Posted July 6, 2006 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.
webman Posted July 6, 2006 Posted July 6, 2006 If you don't have anything server-side that supports this you could use JavaScript. The only disadvantage are the people who disable javascript.
Simcfc73 Posted July 6, 2006 Posted July 6, 2006 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.
Quackers Posted July 6, 2006 Author Posted July 6, 2006 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?
indie Posted July 6, 2006 Posted July 6, 2006 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!
webman Posted July 6, 2006 Posted July 6, 2006 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.
indie Posted July 6, 2006 Posted July 6, 2006 Good point webman, didn't think about that, can you tell i'm an Apache bastard?
Netman Posted July 6, 2006 Posted July 6, 2006 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....
Quackers Posted July 6, 2006 Author Posted July 6, 2006 Got it working now thanks, now i can spend the rest of the day locked in my office with dreamweaver.
Quackers Posted July 7, 2006 Author Posted July 7, 2006 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!
webman Posted July 7, 2006 Posted July 7, 2006 Are you able to post links to these two files at all or upload them to the thread as .txt files?
Quackers Posted July 7, 2006 Author Posted July 7, 2006 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!
webman Posted July 7, 2006 Posted July 7, 2006 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.
Quackers Posted July 7, 2006 Author Posted July 7, 2006 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?
webman Posted July 7, 2006 Posted July 7, 2006 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.
Quackers Posted July 7, 2006 Author Posted July 7, 2006 Thanks webman, deleted what you said and it works now I've stopped smashing things in my office now.
OverWorked Posted July 7, 2006 Posted July 7, 2006 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.
webman Posted July 7, 2006 Posted July 7, 2006 Good to hear you got it sorted... site's looking quite good by the way Simple server-side templating works wonders
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now