Jump to content

Best modern practices for website navigation.


bluebomber
 Share

Recommended Posts

I've recently returned to web design after a 10 year break - a lot has changed.I've spent the last few weeks learning CSS, some very basic javascript and php and also brushing up on my HTML markup.The one thing that eludes me slightly, are what the best practices are these days for ever-present navigation menus that sit on top of every single page in a website.Naturally no one uses frames anymore, and from what I read iframes aren't so great either - recently I've had a go at automatically creating navigation menus on every page using PHP server side includes and similarly with javascript document.write scripts - both worked perfectly well (and when I wanted to edit the navigation menu for every page - I only had to make the chance once), but it's suggested that both methods would be considered very bad practice.So I guess the question is, what exactly do people do nowadays?Also as a side question - is it still safe to use tables when you need to actually display tabular data? I understand that their use may now be deprecated - (and using tables for layout purposes was never a good idea) but is it ok to use them without fear they're going to suddenly be dropped?

Link to comment
Share on other sites

In the case of the javascript include, someone complained to me that the menu would never appear on a browser or device that didn't have javascript enabled, having said this I can't say I was too concerned because pretty much the contents of the entire site I made was javascript dependant anyway - so even if they got past the menu nothing else would have worked.Given that PHP is server side would it be safe to assume that if you were going to use "includes" it's better to do it with PHP over javascript?I guess the reason why I ask is because I've tried to look at what big commercial websites do, but I often can't make head or tail of their code.

Link to comment
Share on other sites

PHP includes is extremely common practice for this sort of thing. And not just menus, but also banners, footers -- anything that needs to look the same on multiple pages. I don't know why anyone would suggest otherwise. When you visit a site that has thousands of pages, they are probably NOT individually authored. More likely, they are generated by a tool that mixes included files with database results.

Link to comment
Share on other sites

Yes. If you want, there are some preconfigured packages such as WampServer that make the installation and maintenance process easier.

Link to comment
Share on other sites

I guess the reason why I ask is because I've tried to look at what big commercial websites do, but I often can't make head or tail of their code.
well, if you're looking for PHP code examples or whatnot (like if they're using includes), then you will never really be able to tell just by viewing the source because that part of the code will never appear in the browser. But you can be sure that if you are visiting a site that is managing lots of content, or repeating common themes across the site, they are actively making use of templating like systems, or at the very least using includes. (as least they should be from a best practices/maintainability standpoint). Edited by thescientist
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...