Jump to content

referencing other files for a menu list


niccio

Recommended Posts

Here is a total newbie question, but I'm a newbie, so here goes:I have a web page I'm making that has several expandable menues with other subexpandable menues and links in them, for example:Menu1..Sub menu 1a.....1link 1a.....1link 1b..Sub menu 1b.....2link 1a.....2link 1bMenu 2..Sub menu 2a.....2Sub menu 1a..........21link 1a..........21link 2a.....2Sub menu 2a..........22link 1a..........22link 2a..Sub menu 2b.....2link 1a.....2link 1betc...What I'm trying to figure out how to do is have a file called, say, "menu1" that would contain:Menu1..Sub menu 1a.....1link 1a.....1link 1b..Sub menu 1b.....2link 1a.....2link 1b and a file called "menu2" that would contain:Menu 2..Sub menu 2a.....2Sub menu 1a..........21link 1a..........21link 2a.....2Sub menu 2a..........22link 1a..........22link 2a..Sub menu 2b.....2link 1a.....2link 1b And in the body of the web site script have a command that would reference those files like:Reference (menu1.txt)Reference (menu2.txt)So the site would act as if the text of those files was in the site. Clear as mud?The problem I'm running into is that as the information grows (currently about 600 links in various folders) the smoothness of the opening of the menus degrades and they become increasingly choppy as they open from the bottom menu up (top menus are still smooth, middle menus are sort of choppy, last menus are really choppy). The only thing I can think to attribute this to is that every time a menu or submenu is opened the files are read from the top down so it has to read through all of the top files before it gets to the bottom ones which makes the bottom ones slow and choppy. My thought is that by putting the menus into seperate files it can skip over all of that text and go straight to the text that is to be used. Any ideas on how to code this?

Link to comment
Share on other sites

Files that contain menus? Menus that read files when the menu is opened? I am not getting the picture at all. Is AJAX involved in this? Where are the files when the menu reads them? Why must all the file be read when just one menu item opens. (What happens when a menu opens? I'm not even sure you mean the same thing by these words that I mean when I use these words.)

Link to comment
Share on other sites

Fair enough, Here's some of the existing code:

[size=1]<div class="arrowlistmenu"><h3 class="menuheader expandable">Menu1</h3><ul class="categoryitems">	<li><a href="*website.html">Idaho</a></li>	<li><a href="*website.html">Montana</a></li>	<li><a href="*website.html">Oregon</a></li>	<li><a href="*website.html">Washington</a></li></ul><h3 class="menuheader expandable">Menu2</h3><ul class="categoryitems">	<li><a href="*website.html">Idaho</a></li>	<li><a href="*website.html">Montana</a></li>	<li><a href="*website.html">Oregon</a></li>	<li><a href="*website.html">Washington</a></li></ul><h3 class="menuheader expandable">Menu3</h3><ul class="categoryitems">	<li><a href="" class="subexpandable">Idaho</a>		<ul class="subcategoryitems" style="margin-left: 15px">				<li><a href="" class="subexpandable2">Test Level 1</a>				<ul class="subcategoryitems2" style="margin-left: 15px">									<li><a href="" class="subexpandable3">Test 1 Sub</a>						<ul class="subcategoryitems3" style="margin-left: 15px">							<li><a href="*website.html">test 1 sub 1</a></li>								<li><a href="*website.html">test 1 sub 2</a></li>						</ul>					</li>									<li><a href="" class="subexpandable3">Test 2 Sub</a>						<ul class="subcategoryitems3" style="margin-left: 15px">							<li><a href="*website.html">test 2 sub 1</a></li>								<li><a href="*website.html">test 2 sub 2</a></li>						</ul>					</li>				</ul>				</li>				<li><a href="" class="subexpandable2">Test Level 2</a>					<ul class="subcategoryitems2" style="margin-left: 15px">						<li><a href="*website.html">test level 2 sub 1</a></li>							<li><a href="*website.html">test level 2 sub 2</a></li>										</ul>				</li>				<li><a href="*website.html"target="_blank">AK 19240798</a></li>				<li><a href="*website.html"target="_blank">Idaho Rev. Statutes</a></li>				<li><a href="*website.html">ID Case Law</a></li>		</ul>	</li>	<li><a href="" class="subexpandable">Oregon</a>		<ul class="subcategoryitems" style="margin-left: 15px">			<li><a href="*website.html">Oregon Rev. Statutes</a></li>			<li><a href="*website.html">Case Law</a></li>			</ul>	</li></ul>[/size]

Instead of having all of that code in the script of the site, I would like to have the actual menu items like:

[size=1]	<li><a href="" class="subexpandable">Idaho</a>		<ul class="subcategoryitems" style="margin-left: 15px">				<li><a href="" class="subexpandable2">Test Level 1</a>				<ul class="subcategoryitems2" style="margin-left: 15px">									<li><a href="" class="subexpandable3">Test 1 Sub</a>						<ul class="subcategoryitems3" style="margin-left: 15px">							<li><a href="*website.html">test 1 sub 1</a></li>								<li><a href="*website.html">test 1 sub 2</a></li>						</ul>					</li></ul>[/size]

Stored in a seperate file so the only thing on the script of the site would be3 something like:

<div class="arrowlistmenu"><h3 class="menuheader expandable">Menu1</h3><ul class="categoryitems"[b] reference(menu1.js)[/b]><h3 class="menuheader expandable">Menu2</h3><ul class="categoryitems"[b] reference(menu2.js)[/b]><h3 class="menuheader expandable">Menu2</h3><ul class="categoryitems"[b] reference(menu3.js)[/b]>

Wherein all of the actual menu items would be in files called "menu1.js, menu2.js, menu3.js, etc" and stored in the root directory of the site. The "menus" are accordion style menus that use a seperate Java file to "animate". A good example of the type of menu can be found here:Accordion Menu LinkHopefully that clears up any questions, but if further clarification is needed I'll do my best!

Link to comment
Share on other sites

so you want to be able to include all your lists instead of having everything written out? You could just include() the entire menu code; I'm saying this because the only reason I could forsee for wanting to do this is to reduce the amount of work you would have to do if you needed to change the menu's, so you don't have change all your pages to make one change in the menu?

Link to comment
Share on other sites

Thank you for the response!That's one big reason for the seperate files, it would simplify the revisions by a ton. There are about 40 main "menus" and if they were all listed in seperate files I could just go to that menu's file, make the changes and save it, bing bang boom, done! The other reason though, and it seems like a strange anomaly, is that the more items I put in, the slower the expandable menus open and close, like its reading the whole file every time until it gets to the part of the menu that the user clicked on. It's very quick if the user clicks on an expandable menu near the top of the list, but if it's something, say, in menu38, it goes very slowly and haltingly. I'm thinking if the menus were placed in different files it could just breeze right over the non-applicable menu references and go directly to the file that matters thereby speeding things up considerably. But for sake of ease, let's just say its for menu organization in case of revisions because there are a lot of menus and it's getting difficult to find the specific parts of the code I'm looking for!

Link to comment
Share on other sites

I just tried a whole slew of variations on <!--#include file (virtual, etc.)="test.txt" -->and could get nothing to work. If this is the right code, I can't for the life of me figure out where to put it!

Link to comment
Share on other sites

Ok, so I apparently did something wrong (surprise!)I cut and pasted the code:

<h3 class="menuheader expandable">test</h3><ul class="categoryitems">	<li><a href="This would be a link.html">Idaho</a></li>	<li><a href="This would be a link.html">Montana</a></li>	<li><a href="This would be a link.html">Oregon</a></li>	<li><a href="This would be a link.html">Washington</a></li></ul>

into a text file and saved it as "test.php" in the root directory of the web site. I then added the code:<?php include("test.php"); ?>right under the div container opening (<div class="arrowlistmenu">)and nothing happens!

Link to comment
Share on other sites

Great. Just found out that our "server" is does not support php. Heap that on top of not having a MYsql or any other type of database and it's basically just a bunch of folders on a hard drive. Actually, that's exactly what it is!Any way to do this with html or java?

Link to comment
Share on other sites

by java do you mean javascript? it is important to note that they are two hugely different things.As far as doing this with javascript, does your code not work the way in the example you provided? Or are you trying to implement it in a completely different way from the example? You might be able to find a cool way to do this with jQuery.

Link to comment
Share on other sites

You could populate the menus on page-load using AJAX, I suppose.Or you could embed JavaScript files at the correct locations, and those files could do a lot of ugly document writing. The webmaster at the college where I teach uses this technique extensively (not because he has to, but because he's a dimwad and doesn't know a server-side language).

Link to comment
Share on other sites

Or you could embed JavaScript files at the correct locations, and those files could do a lot of ugly document writing. The webmaster at the college where I teach uses this technique extensively (not because he has to, but because he's a dimwad and doesn't know a server-side language).
:)do you think he saw the venn diagram from the "what is a web designer" thread and thought, "phew, confirmation that I only have to do front-end work."
Link to comment
Share on other sites

He's been around for a while. I think he started off as a Unix System guy before WWW existed and never quite learned how to be a web guy. I was NOT on the committee that hired him, and the committee was also loaded with systems guys. Our site has sucked for more than a decade.

Link to comment
Share on other sites

ouch. It must be kind of rough to have a school with a less than "fancy" site. Are you mainly a tech-based school?

Link to comment
Share on other sites

We are a community college with a small technical program. Most of our students pursue general education, and if they succeed, they transfer to a 4-year university. For 3 different presidential administrations now, we have not had anyone near the top of the chain who can tell the difference between a good-looking, functional website, and one that just sucks.Our top marketing guy is so #### that he actually paid big bucks for those big ads on the sides of urban buses -- and they all contained a simple, obvious spelling error. What does THAT tell prospective students about a #### college?Yeah. It's rough.

Link to comment
Share on other sites

sorry to hear it DD. :) Thanks for fighting the good fight though; good educators are always hard to find.

Link to comment
Share on other sites

lol. That sounds like our Community College! They put the maintenance departments number on the side of our buses instead of admissions!Anyhow, sorry thescientist, I was referring to javascript, I tend to shorten things up sometimes with the unfortunate side effect that they become something else!Javascript is the only way I can think to do this, but I can't seem to get it to work. I have the <script type="text/javascript" src="Java Files\menu1.js"></script>In the <head>, but I can't seem to figure out what to put in the <body> that would make the site look at the .js file(s) and apply it to the site at the right time and in the right place.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...