Topic: menu Pages that link to <a href="https://ozoneasylum.com/backlink?for=9610" title="Pages that link to Topic: menu" rel="nofollow" >Topic: menu\

 
Author Thread
TheDude
Nervous Wreck (II) Inmate

From: Cincinnati, OH
Insane since: Feb 2002

IP logged posted posted 03-12-2003 19:22 Edit Quote

I want to have a menu where I can make a change and it changes on all pages, so I don't have to make the change on each page manually. I also want to remove the link for whatever page I'm on and just have it text. (Like if I'm on the home page, the home link on the menu is just text and not a link.)
What is the best procedure for this?
Thanks.

TheDude

Perfect Thunder
Paranoid (IV) Inmate

From: Milwaukee
Insane since: Oct 2001

IP logged posted posted 03-12-2003 19:50 Edit Quote

If you have access to PHP, you'll have an easy time. Just put your menu in a different page ("menu.php," for instance) and then refer to it on every other page with include("menu.php");. Your "menu.php" will be included on every page, and if you make a change to it, the change will be reflected everywhere.

If you don't have PHP, you might at least have server-side includes -- in that case, you'd have to name your page with the .shtml extension, and put <!-- #include virtual="menu.html" --> where you want the menu to appear.

The link thing you're talking about would be easy with PHP, impossible with just server-side includes. The easiest way to do it in PHP would be to create an associative array where each key is the link text and each value is the href. (That is, $menu_array = array("Home" => "/index.php", "Whupass" => "whupass.php", etc).) Then run through your menu with

code:
while (list($key, $value) = each($menu_array))
{
if ($value == $PHP_SELF)
{
echo "<p><span class=\"current\">$key</span>\n\n";
}
else
{
echo "<p><a href=\"$value\" title=\"$key\">$key</a></p>\n\n";
}
}



span.current is a CSS class which contains the formatting for the current page. Say you want the menu to have all the active links in small blue text, but the page you're on shows up with a yellow background and black text, just "span.current { background: yellow; color: black; }" and there you go.

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

IP logged posted posted 03-12-2003 20:50 Edit Quote

You have a variety of options for your first issue. The GN has some great resources on them -

PHP - http://www.gurusnetwork.com/tutorials/php/phptemplate/phptemplate.html

PHP - http://www.gurusnetwork.com/tutorials/php/phptemplate2/phptemplate2.html

SSI - http://www.gurusnetwork.com/tutorials/ssi/ssi1_intro.html

JS - http://www.gurusnetwork.com/tutorials/javascript/jsmenu/javascriptmenu.html

JS - http://www.gurusnetwork.com/tutorials/javascript/jsadvmenu/jsadvmenu.html

JS - http://www.gurusnetwork.com/tutorials/javascript/javascriptssi.html



TheDude
Nervous Wreck (II) Inmate

From: Cincinnati, OH
Insane since: Feb 2002

IP logged posted posted 03-12-2003 22:13 Edit Quote

Thanks for the replies. I'll check into that stuff.

TheDude

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

IP logged posted posted 03-13-2003 02:01 Edit Quote

TheDude: We use something like that at the GN - there are 3 states to the main navigation graphics on, off and home. You can process the URL to find out if you are in say:

/news/my_file.php

and if so you can change the base state (which is usually 'off') to 'home' - have a look at the links section of the GN for example:
http://development.gurusnetwork.com/links/

As you don't want rollovers this is even simpler. Process the URL so you get:

$folder = 'news'; and if so then don't make the News link active.

I'm not sure if that helps or not but you certainly want to look at PHP includes as they can make your life easier. Getting that script working shouldn't be too much bother.

___________________
Emps

FAQs: Emperor

TheDude
Nervous Wreck (II) Inmate

From: Cincinnati, OH
Insane since: Feb 2002

IP logged posted posted 03-14-2003 06:55 Edit Quote

Pardon my ignorance, but does php affect spidering?

TheDude

DmS
Paranoid (IV) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

IP logged posted posted 03-14-2003 10:27 Edit Quote

Well yes, it might.
Let's say that you keep all your metadata in one include, all your headers, content and footer in separate includes and the actual page is only a set of include-instructions that pulls in all the parts of the page.

As a spider requests the page there is a definate risk that the include instructions won't be executed by the server, then the spider only sees the include instructions.

I'm not 100% sure on this, but I'm pretty sure it applies to a lot of the spiders, perhaps not all, but still.
/Dan

{cell 260}
-{ a vibration is a movement that doesn't know which way to go }-



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu