• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0
Sign in to follow this  

Menu Bar in Separate HTML File

Question

CPressland    176

Hey guys,

We're currently building an Intranet from scratch at work and for simplicity reasons would like the Menu Bar in a separate HTML File so that if we've gotta add anything we won't need to make that change in EVERY file.

Any assistance on this would be great.

Thanks Guys

Chris Pressland

Share this post


Link to post
Share on other sites

15 answers to this question

Recommended Posts

  • 0
Plarkster    6

I've never been involved with intranets, but have use simple includes on websites to keep the menu separate. This site has lots of info.

The only problem I had was that I couldn't preview the site on my computer as the includes didn't work because they're server side. Don't know how it will affect intranet.

Hope that helps!

Edit: lol @ my eliteness! :)

Share this post


Link to post
Share on other sites
  • 0
motomotomd    0

As with the comment made above, using PHP or similar language to include the file in question is usually what I do. If your web server doesn't support PHP or similar, then you could always try using an IFrame...

Share this post


Link to post
Share on other sites
  • 0
CPressland    176

I've never been involved with intranets, but have use simple includes on websites to keep the menu separate. This site has lots of info.

The only problem I had was that I couldn't preview the site on my computer as the includes didn't work because they're server side. Don't know how it will affect intranet.

Hope that helps!

Edit: lol @ my eliteness! :)

Lengend, Thanks dude

Share this post


Link to post
Share on other sites
  • 0
CrossCheck    325

why are you using html......lil dated are we. you could use frames and put your menu in a frame so basically you are viewing 2 html pages in the same browser tab. http://www.w3.org/TR/REC-html40/present/frames.html

Share this post


Link to post
Share on other sites
  • 0
Descartes    130

If your server supports PHP, you can use the include function:

<?php include "menubar.html";?>

Please don't use frames, they're really not meant to serve as a part of the site's layout, and they'll most likely just **** off your visitors.

Share this post


Link to post
Share on other sites
  • 0
CPressland    176

why are you using html......lil dated are we. you could use frames and put your menu in a frame so basically you are viewing 2 html pages in the same browser tab. http://www.w3.org/TR/REC-html40/present/frames.html

Because it's the standard Web language? lmao

If your server supports PHP, you can use the include function:

<?php include "menubar.html";?>

Please don't use frames, they're really not meant to serve as a part of the site's layout, and they'll most likely just **** off your visitors.

+1, frames are the single most evil thing in history!

Will use that PHP script

Share this post


Link to post
Share on other sites
  • 0
Guest   

PHP is the way to go.

Share this post


Link to post
Share on other sites
  • 0
Code Name: Lockdown    9,517
why are you using html......lil dated are we. you could use frames and put your menu in a frame so basically you are viewing 2 html pages in the same browser tab. http://www.w3.org/TR...ent/frames.html

1) HTML is STILL the language web pages are coded in (or at least a version of HTML - XHTML or HTML5 for example). This has never changed. If you are referring to scripting languages such as ASP, PHP and so on - you are barking up the wrong tree.

2) You talk about HTML being dated then suggest frames of all things? Wow...

Sorry, you tried to condescend and then utterly failed and showed how little you know. Take your attitude elsewhere.

To the OP:

Save the file as "mainmenu.html" and them simply include it as show above (assuming you have access to PHP or ASP). Else read here: http://www.google.co.uk/search?q=include+file+using+javascript&ie=utf-8&oe=utf-8&aq=t&client=firefox-a&rlz=1R1GGLL_en-GB___GB377

Share this post


Link to post
Share on other sites
  • 0
AnthonySterling    11

why are you using html......lil dated are we. you could use frames and put your menu in a frame so basically you are viewing 2 html pages in the same browser tab. http://www.w3.org/TR...ent/frames.html

Say wha'? Crazy foo'!

Share this post


Link to post
Share on other sites
  • 0
CPressland    176

Say wha'? Crazy foo'!

How you doing man?

Share this post


Link to post
Share on other sites
  • 0
Cupcakes    151

why are you using html......lil dated are we. you could use frames and put your menu in a frame so basically you are viewing 2 html pages in the same browser tab. http://www.w3.org/TR/REC-html40/present/frames.html

LOL wow that made my day; Thank you!

That being said: HTML is still a web language that is being used and will always be used. Might want to read up on HTMl5.

PS - Frames are so 1999.

Share this post


Link to post
Share on other sites
  • 0
CPressland    176

Hey Guys,

Sorry to bother all of you on this again but I tried the PHP include script and it didn't work.

Please overview these files and tell me what I'm doing wrong...

http://cpressland.com/intranet/

Thanks

Chris

Share this post


Link to post
Share on other sites
  • 0
DeathLace    11

Vegetunks,

You have the right idea, but the file that is running the PHP script must be of type .php, not .html like you currently have it. This way your web server knows to run the file as a PHP file, allowing it to run PHP commands.

Your web server will need to have PHP installed, most do, but rename the file first to newmenu.php and we'll go from there :)

Share this post


Link to post
Share on other sites
  • 0
Colin-uk    135

you could also use server side includes if your web server supports it.

Share this post


Link to post
Share on other sites
  • 0
CPressland    176

I'm such an idiot sometimes... I always use PHP files, as this is somebody else's work I didn't even THINK to look at the extension.

Thanks Guys, FIXED!

Now to update every file, one down, three hundred to go.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.