Loading Drop down Menu From External File

Reply

Join Date: Jan 2009
Posts: 68
Reputation: jonow is an unknown quantity at this point 
Solved Threads: 0
jonow jonow is offline Offline
Junior Poster in Training

Loading Drop down Menu From External File

 
0
  #1
Feb 19th, 2009
Hi, I am trying to make a website were the menu is loaded from an external file so when you want to update the menu it gets updated on all the web pages. Something like and iframe but the problem is that the dropdown menu of an iframe will be inside the iframe and not in the webpage. Does anybody have a solution make an iframe work with this or another method of doing this? I am not going to use PHP or SSI at all. And I would like to stay away from using JavaScript, ALAX and alike, but I know the solution will probably have to use those. So if someone has suggestion (especially in basic languages like HTML and CSS) please post. Thank You
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 45
Reputation: colweb is an unknown quantity at this point 
Solved Threads: 1
colweb colweb is offline Offline
Light Poster

Re: Loading Drop down Menu From External File

 
0
  #2
Feb 19th, 2009
Well, I'm doing just that with a new site I'm building. The menu is a huge drop down thing.

If you are hosting the site on Apache then (it needs to be turned on in the configuration), all you have to do is include something like this:

<body>
<!--#include virtual="/include/menu.html"-->
-- rest of your code --

See also this thread: http://www.daniweb.com/forums/thread162966.html, but I think he didn't understand it completely and is using php now.

Please ignore my answer. After typing it I read that you don't want to use SSI. What you want is simply not possible. There is no html code to include external files. And css is only there for styling. Maybe it's possible with an iframe and z-index. There is something about that here: http://www.webmasterworld.com/forum21/6457.htm.
Last edited by colweb; Feb 19th, 2009 at 2:41 pm.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 68
Reputation: jonow is an unknown quantity at this point 
Solved Threads: 0
jonow jonow is offline Offline
Junior Poster in Training

Re: Loading Drop down Menu From External File

 
0
  #3
Feb 19th, 2009
Thank you, how would you set up SSI or PHP that is simple and small, if possible. And can you test SSI withotu having it on a server.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 45
Reputation: colweb is an unknown quantity at this point 
Solved Threads: 1
colweb colweb is offline Offline
Light Poster

Re: Loading Drop down Menu From External File

 
0
  #4
Feb 19th, 2009
jonow,

And can you test SSI withotu having it on a server.

No you can't. As the name implies, SSI is a server thing and for as far as I know, it can't work or tested without having an SSI enabled webserver.

PHP is also a server side thing. It normally runs on the webserver and yes, there are programs that, to some extend, show you what your php code would do in the real world. But to really test it, you do need a webserver.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 68
Reputation: jonow is an unknown quantity at this point 
Solved Threads: 0
jonow jonow is offline Offline
Junior Poster in Training

Re: Loading Drop down Menu From External File

 
0
  #5
Feb 20th, 2009
Would it be inefficient to have an iframe for each drop down menu so you would have the drop down menu on the page but loading the contents from an external page into and iframe into the menu and and the sub-menus.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 11
Reputation: ZWheel is an unknown quantity at this point 
Solved Threads: 0
ZWheel's Avatar
ZWheel ZWheel is offline Offline
Newbie Poster

Re: Loading Drop down Menu From External File

 
0
  #6
Feb 23rd, 2009
If you really do not want to use any of the technologies you mentioned then probably your only other option would be to use a WYSIWYG html editor which will handle it for you. For example in Dreamweaver I know you can create a "Library Item" which is just a block of html which you attach to other pages. Then when you want to change it you just edit the Library Item once and it changes it in all the pages you attached it to. Your still uploading whole pages though when you go to publish but at least you don't have to make all the edits manually.

Otherwise, I would suggest you go with a server-side solution. For such a simple task any server side language should do just fine, myself I am familiar with PHP and would do this:
<?php include('menufile.html'); ?> That's as complicated as it need be. I actually used this to set up a very simple site at my workplace of the time where they could edit content by changing text files in notepad. This was years before I learned any other PHP commands.

Maybe you can come up with something using an iFrame plus javascript but if you do it's going to be really hacky and how well will you be able to rely on it working and looking the same across different web browsers? And what will it look like if they print the screen? Will it affect bookmarking? Mobile browsers (cellphones)?

Server side is nice because it's still straight html to the user.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 11
Reputation: ZWheel is an unknown quantity at this point 
Solved Threads: 0
ZWheel's Avatar
ZWheel ZWheel is offline Offline
Newbie Poster

Re: Loading Drop down Menu From External File

 
0
  #7
Feb 23rd, 2009
Originally Posted by colweb View Post
jonow,

And can you test SSI withotu having it on a server.

No you can't. As the name implies, SSI is a server thing and for as far as I know, it can't work or tested without having an SSI enabled webserver.

PHP is also a server side thing. It normally runs on the webserver and yes, there are programs that, to some extend, show you what your php code would do in the real world. But to really test it, you do need a webserver.
A webserver is not a hard requirement to meet.

If you are on Windows and don't want to become a server guru I would recommend looking into the Abyss webserver by Aprelium. It's free, easy to setup and easy to integrate with Perl or PHP. Yes, Windows comes with IIS but if you have installed any service packs then the IIS version on your Windows CD will probably not install easily, Abyss is just going to be easier.

If you're on Linux of course Apache and PHP are a no-brainer. Your distro's package manager will probably configure it well enough for your needs right out of the box, again no server guru skills necessary (unless you want to host it on your own machine but I don't think you do).

No idea if your on a Mac. I doubt it's difficult there either, I just don't own one to try it.

Oh, and if the host you publish to doesn't provide any server side languages just dump them. Really... hosting is so cheap these days. You can probably get one which will fit your needs for < $10 US / month, if not then certainly for < $20.
Last edited by ZWheel; Feb 23rd, 2009 at 2:54 pm.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,315
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 161
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: Loading Drop down Menu From External File

 
0
  #8
Feb 24th, 2009
in the iframe menu
'target='_top' will change the highest level url
target='_parent' will change the immediate parent window url

ergo
menuiframe.html
  1. <a href='home.html' target='_top'>Home</a>
  2. <a href='page1.html' target='_top'>page 1</a>
  3. <a href='page2.html' target='_top'>page 2</a>
  4. <a href='page3.html' target='_top'>page 3</a>
its just a matter of
Read The F(ine) Manual
http://www.w3schools.com/tags/tag_a.asp
Last edited by almostbob; Feb 24th, 2009 at 10:09 pm.
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 77
Reputation: mj080 is an unknown quantity at this point 
Solved Threads: 5
mj080's Avatar
mj080 mj080 is offline Offline
Junior Poster in Training

Re: Loading Drop down Menu From External File

 
0
  #9
Mar 23rd, 2009
the only problem i would have with using an iFrame is that it would cut of your bottom content. i would suggest that you perhaps use Java (although you said that you didn't want to) and a master page, so you wouldn't have to include it on all the pages.

otherwise, if you are unwilling to do that, you could always chuck up a large amount of cash for componant art.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,315
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 161
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: Loading Drop down Menu From External File

 
0
  #10
Mar 23rd, 2009
put the menu,
which is a known size,
in an iframe top of the content pages,
not the content in an iframe at the bottom of the menu.
the content page will then size as neccessary
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the HTML and CSS Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC