[web] Gamedev's Navbar

Started by
5 comments, last by Spintwo 19 years, 8 months ago
How does Gamedev do the navbar? I'm trying to come up with an algorithm of some kind that will allow for easy maintainability. The navbar has the lsat link being thet current page the user is in adn the pages before that in order to get to that page. I could think of a way to go forward, just post/get variables but waht hapepns when they go backwards into a part of the navigation tree?
Advertisement
Hi,

You mean the "GameDev.Net Discussion Forums > Web Development > Gamedev's Navbar" bit? That really doesn't track the pages you have visited. Instead, it simply gets the hierarchy from the forums database. It goes Category > Forum > Thread, I guess.

Vovan
Vovan
In my current evolutional site, it's hard coded. Obviously this isn't the best answer, so you need to maintain some form of breadcrumb trail stack. I'm still figuring out how to do this in an efficient way, so if you find out I'm all ears.

One possible way is to store a session variable with the last visited pages. This would be a "true" breadcrumb, as it tracks each page you visit. Obviously, this idea is messy.

Another way would be to store a sort of site database, so you know that on a given page you can trace the crumbs from index to current. Again, this is a bit of a nightmare in a truly dynamic CMS system as you'll have to constantly rebuild the site database when pages are added, removed or moved.

How GameDev does it (I can imgaine) is a mixture of static crumbs (so the forums page automatically appends index and forums to the trail). The next is then obtained in a lookup from the forum ID and the current thread is pulled from the thread id query.

I remember Michael Tanzcos saying he uses XML a lot, so adding such a setup would be fairly trivial.

In evolutional, I have my trail in XML - specified by

<breadcrumbs>  <crumb name="index" url="/" />  <crumb name="news" url="/news.asp" />  <crumb name="rss" url="/news.asp?rss" /></breadcrumbs>


When I move over to a fully dynamic CMS system, I'll write some ASP to add these crumbs to the trail - partially through static structuring and partially through database lookups. So; if I add a page to my news page, it'll automatically receive the 'news' crumb as it's root and the trail up to this page is stored in the page database.

Uhm, I'm babbling out loud now.
I query the db based on a few parameters, the URL is being the most dominate item.

Create a binary tree of the data in a recordset and return it....
you can do this by doing some research into Joe Celko on google.
Google!
--What are you nutz?I have nothing to say to your unevolved little brain. The more I say gives you more weapons to ask stupid questions.
Hmm..I thought of this:

You have all possible pages in a mysql list, like so:

news.php - home -> news
forums.php - home -> forums
forums.php?threadid=23 - home -> forums -> (forum adds to home -> forums)
blogs.php - home -> news -> blogs
articles.php home -> art -> articles -> (same thing as the forums)

All of the pages's heirachy's are stored in database and variables for the entire link and arrow stored in a php file off teh server's online directories. Would this work?

I think we implement the bread crumbs concept in a somewhat satisfactory way. The way to get much more advanced would be to store pages in a database that have a defined parent page. You could then go so far as to pre-generate and store the breadcrumbs links and keep them in a database for easy access (that only requires a single lookup).

This is particularly good in situations when you want to present a whole lot of data categorically while presenting a few sub-categories in each option.

---
Michael Tanczos
Quote:Original post by Michael Tanczos
I think we implement the bread crumbs concept in a somewhat satisfactory way. The way to get much more advanced would be to store pages in a database that have a defined parent page. You could then go so far as to pre-generate and store the breadcrumbs links and keep them in a database for easy access (that only requires a single lookup).

This is particularly good in situations when you want to present a whole lot of data categorically while presenting a few sub-categories in each option.

---
Michael Tanczos


Thanks, I think I know how to go about it now.

This topic is closed to new replies.

Advertisement