View Full Version : Help! How is this done?


mikeb
07-27-2004, 04:00 PM
On each page of our site we have a drop down menu. Customers can search by product line or brand.

However, we are adding many new brands and many new pages. This is completely unmanagable at this point and I can't (and haven't) keep adding to this list for the hundreds of pages we have.

I'm wondering if there's any way to have something like this:
<form>
<select name="worldwide" size="1" onChange="location.href=this.form.worldwide.options[this.form.worldwide.selectedIndex].value">
<option>Search Products
<OPTION VALUE="http://www.milleniumfitness.com/example1">Example</OPTION>
<OPTION VALUE="http://www.milleniumfitness.com/example2">Example</OPTION>
<OPTION VALUE="http://www.milleniumfitness.com/example3">Example</OPTION>
</select>
</form>

On each page of our site yet not have to manually go to each and every page everytime we add a new "example"? Some sort of redirect or java or something? Please keep in mind that I know ZERO java but maybe can buy a js or...anything?

Thanks

Pyrrhonist
07-27-2004, 04:37 PM
Sorry, mike,

Can you be a bit clearer on what you're looking for? If you're trying to make it dynamic, i'm sure we can help you, but i'm not sure what you're asking in your post.

mikeb
07-27-2004, 05:22 PM
Thanks Bob, I'll try:
I guess in a nutshell, I'm trying to be able to add new items to a drop down menu that appears on hundreds of pages without manually updating and then uploading each page to our host.

More specifically, one example would be this - If we take on a new brand of products, we would of course want this to be shown in a drop down menu that allows a user to search "brands". And, we would want this drop down menu to appear on every page in our site. At over 500 pages, it's a bit tough to do this. Is there any way to do it other than manually entering and then uploading to each and every page?

If you go to http://www.milleniumfitness.com and look at the drop menus for "search products" and "Search Brands", this is what I'm talking about. Let's say I want to add the brand Acme. How to I get this on every page easily and efficiently.

Sure hope that clarifies it a bit.

Thanks,
Mike

clasione
07-27-2004, 06:16 PM
Yea- Get Dreamweaver ............


Find and replace something on everypage with your menudropdown...

dilligaf
07-27-2004, 08:09 PM
Not in HTML... PHP, ASP, CF, ASPX? What would you be working with?

mikeb
07-27-2004, 10:33 PM
It's all html
:confused:

Pyrrhonist
07-27-2004, 11:47 PM
You could stick the dropdown into an include file, and then you only have to update file and the changes are reflected site-wide.

If you were using php, and don't want to do an include file, you could use a global array that is loaded with a while loop (why not just use an include instead, though).

Or if your content is db loaded, you can easily do a loop for all the unique brands (or entries in the brands table) and load it that way.

leeds1
07-28-2004, 01:52 AM
or you have a JS file referred to in each page (it's what I have on one of my sites) then I just update the external file and hey presto the whole site is updated (trouble is search engines cant read it so I have to have manual links as well - hey ho..)

owlcroft
07-28-2004, 02:56 PM
This should be a piece of cake[1].

Use "server-side includes" to include a single piece of HTML into every page you need it on. Make a file--let's assume it's named options.html and is in a directory named /ssi. It might have in it--

<form>
<select name="worldwide" size="1" onChange="location.href=this.form.worldwide.options[this.form.worldwide.selectedIndex].value">
<option>Search Products
<OPTION VALUE="http://www.milleniumfitness.com/example1">Example</OPTION>
<OPTION VALUE="http://www.milleniumfitness.com/example2">Example</OPTION>
<OPTION VALUE="http://www.milleniumfitness.com/example3">Example</OPTION>
</select>
</form>

--and that's all. Then, on any page of your site where you want that code to appear, you place an SSI directive like this:

<!--#include virtual="/ssi/options.html" -->

Apache has up a nice tutorial on SSI (http://httpd.apache.org/docs/howto/ssi.html) . They are ineffably handy for uses of just this sort. I have scarcely a page on any web site whose footer is not an SSI include. (P.S. yes, you can nest them.)

[1] "Radial segment of baked confection--relevance to Key Of Time: zero."
-- K-9

mikeb
07-29-2004, 09:38 AM
Sent you a pm Eric

mikeb
07-29-2004, 12:24 PM
okay..think i have this figured out and was able to do the ssi in a test page.
BUT....I was told to add Options +Includes to my htaccess file which i did. The only thing that I'm wondering is, do I now have to change the name of every page from index.html to index.shtml? It does not seem to work unless this is done and from the apache.org site I'm gathering this is the only way?

jocelyn
07-29-2004, 12:49 PM
[QUOTE=mikeb]The only thing that I'm wondering is, do I now have to change the name of every page from index.html to index.shtml?[/QUOTE]
No you can set the server to accept other file types as server parsed.
If you have a Cpanel because you are on a apache server, you can do it from there. You go to apache handlers and add the extention .html as server parsed and voila... all .html will work and no renaming.

mikeb
07-29-2004, 03:11 PM
[QUOTE=jocelyn]No you can set the server to accept other file types as server parsed.
If you have a Cpanel because you are on a apache server, you can do it from there. You go to apache handlers and add the extention .html as server parsed and voila... all .html will work and no renaming.[/QUOTE]


I really appreciate everyones help here. Jocelyn Idon't have access to a cpanel but have been doing a bunch of googling and have come up with something that is working. Maybe someone can tell me if somethin'll blow up if i do this... :confused:

I have now placed in my .htaccess:
Options +Includes

and also

AddType text/html .html
AddHandler server-parsed .html
AddHandler server-parsed .htm

Things seem to be working. Does this look kosher to everyone?

Of course, the ssi directory stuff is still the same etc, etc.

Mike