Jump to content
  • Advertisement
Sign in to follow this  
d000hg

[web] Navigation bar

This topic is 4796 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm changing a website from having a navigation bar as a separate frame, to using CSS to position the bar at the side of the screen. But this raises a couple of problems: 1)If the bar is now part of the page, I don't really want to cut 'n' paste the code for it into every page - this just seems pointless and not good if I want to change anything later. 2)I want the navigation bar to know which page you're currently on. For isntance if you click on the 'downloads' item on the bar, the page loads and the 'downloads' item in the bar is now not a link. So what is the easiest way to accomplish these things? I can easily put a variable in each page (or use the pages' filenames) to tell which page is currently loaded; to save having the same nav-bar code in many places I could put it all in a java function in a separate .js file? Or I could use ASP/PHP but is that required here?

Share this post


Link to post
Share on other sites
Advertisement
There are several ways to achieve this, but I always do this using PHP.

1) You can then just use <? include("menu.php"); ?> and then there should be your one menu page.
2) If you use a variable like page. This gives you the option to for example use this also in your menu to highlight the active item etc.

I think there are enough resources on PHP on the web to find out how to do this exactly.

Share this post


Link to post
Share on other sites
Maybe I should refresh my server-scripting skills! I've done this or something similar in ASP but it was so long ago... I did implement a java version but that was dependent on java being turned on for the browser. I'd better find out what scripting the server supports - is it common for PHP and ASP to be supported on a server or is it normally one or the other? (This is for a client not my own site)

Share this post


Link to post
Share on other sites
PHP is (and can be) installed on almost any server, ASP only on servers running Microsoft Windows Server.

Noteworthy: recently, there has been an invitation made for hackers to hack 'www.hackiis6.com', because it would prove how secure the new Windows Server version was. Well, if you visit it right now (01-06-05), it's (finally) offline! So IIS is pretty insecure.

Share this post


Link to post
Share on other sites
Quote:
2)I want the navigation bar to know which page you're currently on. For isntance if you click on the 'downloads' item on the bar, the page loads and the 'downloads' item in the bar is now not a link.
If you can live without this feature (a lot of sites do), a sitewide navigation bar could be accomplished with a simple server-side include. Otherwise, you would have to do server-side scripting, either by using the 'variable' method or some fancy string matching stuff.

Share this post


Link to post
Share on other sites
Quote:
Original post by Pipo DeClown
PHP is (and can be) installed on almost any server, ASP only on servers running Microsoft Windows Server.


Unless of course you decide you want to run ASP on another platform without regard for FUD, in which case you simply use a LINUX/UNIX/Mac/BSD/Solaris ASP platform (like Chilisoft).

Share this post


Link to post
Share on other sites
Quote:
Original post by Rob Loach
Something like this? You might want to check out Smarty.


Smarty is probabely a tad overkill for just a menu include, but for more complex sites it's definately a great tool!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!