Log in

View Full Version : menu in all pages



dragoth
01-26-2010, 09:10 PM
alright i have a problem i am trying to add a mean you to all my pages and the menu is in head.html and i want to add it all the pages with haveing to go to every page to edit the menu

Nile
01-27-2010, 12:44 AM
Mind telling us if your host supports PHP?

dragoth
01-27-2010, 03:01 PM
they host everything but ruby

djr33
01-27-2010, 03:54 PM
You can search through the old discussions here for many options.
If you can use PHP, though, it should be easy.

<?php include('directory/menu.htm'); ?>

That's all.

Place that code where you want your menu to appear in every page and it will be inserted there.

Make sure that the main pages end with .php. (.htm will skip the php code.)

Also, this is embedding the code of menu.htm directly into your page, so plan ahead: don't include <html>...</html> tags, don't have an extra <head> section, remove extra tags, etc. After you set this up, go to one of the pages and choose view>source, and see what the generated code looks like.

dragoth
01-27-2010, 04:38 PM
what if i dont want to rename all the pages

djr33
01-27-2010, 04:41 PM
Then:
1) Find another way aside from php (but php is the most customizable, useful way).
or
2) Set your server to parse all .htm/.html pages as php. This is possible, but inefficient, because every page will be parsed that doesn't have to be. Some people do this, though. Up to you.
It looks like the code you need in your .htaccess file is this:
AddType application/x-httpd-php .html

See more info here:
http://www.webmasterworld.com/forum92/2298.htm

But again, be careful when setting your server to parse every .htm page as .php if you don't need to.

dragoth
01-27-2010, 04:45 PM
thanks alot

molendijk
01-27-2010, 06:02 PM
The fact that Dragoth has his menu in head.html suggests that he is using a frameset. If so, the solution for having a menu on every page must be different.

Dragoth, are you using a frameset?
===
Arie Molendijk.

djr33
01-27-2010, 06:13 PM
Yes, PHP is an entirely different approach from frames, and much better (because it ends up being a single page for the viewer).
If head.html is for a frame, then it will need to be recoded as above.

And by the way, that link in my post is not necessarily the best information, just the first one that popped up on a google search. It should be easy to find more if you need it.

dragoth
01-28-2010, 12:39 AM
no im not using frame set

Nile
01-28-2010, 12:55 AM
Did you solve your problem?

dragoth
01-29-2010, 05:54 PM
yeah you guys did and thanks alot