Page 1 of 1
Setting up a Dynamic Root Structure Link Bar
Posted: Mon Jun 28, 2004 12:59 pm
by NewfieBilko
What I mean is like what you can see on this site.
DevNetwork Forums-> Forum Index -> PHP- Code -> This post
i was wondering the best logical way to approach this with a simplair site then this. Say I have 5-6 pages, and each of those pages go on to a selection of 4 pages each. How can I have 1 top_bar include that would go:
Home -> Page 1 -> Selection 4.....
Setting up varabiles for each of these sections then making true if it is on that page that session? I'd like to know others opinions on approaching this problem.
Posted: Mon Jun 28, 2004 3:08 pm
by McGruff
Each hyperlink contains a command and some command parameters. In order to define hyperlinks, just grab any variable parameters from wherever they are stored. In the forums example, that'll be a JOIN query: each topic is a member of a board which is a member of a forum.
Posted: Mon Jun 28, 2004 3:15 pm
by patrikG
Breadcrumb navigation can also, as McGruff implied, reflect the physical structure of your filesystem if you set it up that way. In the interest of user-friendly (i.e. short) URLs this is not the most common practice, though.
Posted: Wed Jun 30, 2004 6:03 am
by NewfieBilko
this requires setting all my url structures into a database then
Posted: Wed Jun 30, 2004 2:05 pm
by NewfieBilko
im not sure if i understand. Does anyone have any ideas on the best way to go about implimenting a navagation bar like this one into a site:
Ok, i dont mean to confuse, i just need a dynamic system for rooting where the enduser is, so he/she can move back through the steps it took to get there. Whats the best way to approach this problem when you already have a hard coded, smarty PHP system in production?
Posted: Wed Jun 30, 2004 2:11 pm
by pickle
How about a cookie? Every time someone goes to a page, you modify the cookie to be updated with the page they are on. For example. If someone goes to your index.php page, set the cookie to "index.php". From there they click a link to admin.php. On that admin.php page, you modify the cookie to be "index.php|admin.php", and so on. Then you can parse the cookie and make that link structure you want.
Posted: Wed Jun 30, 2004 2:16 pm
by feyd
database.
table structure similar to:
pages table
pageid int(10) unsigned not null auto_increment,
parentid in(10) unsigned not null,
urlid int(10) unsigned not null
url table
urlid int(10) unsigned not null auto_increment,
url varchar(255) not null,
urltext varchar(100) not null
then use mysql's internal looping (if possible) to grab each of the parents until the parentid is 0..
Posted: Thu Jul 01, 2004 7:11 am
by NewfieBilko
hmmm, both of you seem to have alright ideas.. hmmmmm, interesting.. something to think about.
Posted: Thu Jul 01, 2004 7:27 am
by patrikG
Pickle's idea will allow a user to backtrace which pages they've visited on a site - the more someone would navigate, the longer the breadcrumb-navigation would be.
Feyd's idea is more feasible as it presupposes a fixed site-structure.
Posted: Thu Jul 01, 2004 8:01 am
by NewfieBilko
Yea im gonna try the database way. Considering everything else will eventually be put into databases for my site I might as welll have this.
So i drew up the 2 new tables. Im gonna fool around with them both a bit now, entering the page information. Then work on getting it called the right way.
Posted: Thu Jul 01, 2004 8:01 am
by NewfieBilko
my primary key/foriegn key, they will link the urlid's
Posted: Thu Jul 01, 2004 10:35 am
by NewfieBilko
i wanted 111 posts, thx