473,480 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

idea/ concept behind creating breadcrumbs

Hi everybody,

I want to create dynamic breadcrumbs for a site I am developing. I just
want to get some views about the algorithm of breadcrumbs.

The way I look at it is the concept of parent/ child (main/ sub). I
have the "Home" page, which has links to sub-pages such as
"Introduction", "History", "Timetable", etc. Each page can have other
sub-pages, such as "Timetable" can have "Semester1", "Semester2", etc.
This is how I'd initially think. Am I on the right track? If yes, how
do I proceed? Do I need a database or is there another efficient way to
do it? If it is in fact the way I am thinking, then I think I need a
way to "register" or hold the data in some way and access it on each
page. I'm just lost here.

Please push me to the right direction.

Thanks
Ben

Jul 21 '06 #1
9 4403

crescent...@yahoo.com wrote:
Hi everybody,

I want to create dynamic breadcrumbs for a site I am developing. I just
want to get some views about the algorithm of breadcrumbs.

The way I look at it is the concept of parent/ child (main/ sub). I
have the "Home" page, which has links to sub-pages such as
"Introduction", "History", "Timetable", etc. Each page can have other
sub-pages, such as "Timetable" can have "Semester1", "Semester2", etc.
This is how I'd initially think. Am I on the right track? If yes, how
do I proceed? Do I need a database or is there another efficient way to
do it? If it is in fact the way I am thinking, then I think I need a
way to "register" or hold the data in some way and access it on each
page. I'm just lost here.

Please push me to the right direction.

Thanks
Ben
Hi, you can use _GET for this, easiet way is like
index.php?cat=$cat&sub=$sub&id=$id for as many depths as needed, you
just need to make sure each link on your page adds/removes the required
strings. you could use numbers or names, i use names in mine so i dont
need to have a database and i can capatilise the first letter of the
word and remove underscores ect so it tidies it up when display the
breadcrumbs.

Flamer.

Jul 21 '06 #2
Well if you have a database then that would be a good place to start.
If you are not currently using a database you could store the
relationships in an include file and include_once it into each page.

For a database I would do something like:

"id","pagename","parent_id"
1,"Home",0
2,"Introduction",1
3,"History",1
4,"Timetable",1
5,"Semester1",4
6,"Semester2",4
....

Then use a recursive function to "walk" up and down the tree:

function printnode($node) {
if ($node->parent_id) {
printnode(getNode($node->parent_id));
}
echo $node->pagename;
return;
}

This is an oversimplification obviously but you get the idea. The page
needs to call printnode(getNode(PAGE ID)) to print it's path. getNode
is not shown here but it takes the ID as a parameter and returns an
object with the information returned from the database. You could also
store the relationship like this:

$pagedata = array(
1 =array('pagename',parid),
2 =array(...),
....
);

Hope I explained clearly enough and answered your question.

-Robert

cr*********@yahoo.com wrote:
Hi everybody,

I want to create dynamic breadcrumbs for a site I am developing. I just
want to get some views about the algorithm of breadcrumbs.

The way I look at it is the concept of parent/ child (main/ sub). I
have the "Home" page, which has links to sub-pages such as
"Introduction", "History", "Timetable", etc. Each page can have other
sub-pages, such as "Timetable" can have "Semester1", "Semester2", etc.
This is how I'd initially think. Am I on the right track? If yes, how
do I proceed? Do I need a database or is there another efficient way to
do it? If it is in fact the way I am thinking, then I think I need a
way to "register" or hold the data in some way and access it on each
page. I'm just lost here.

Please push me to the right direction.

Thanks
Ben
Jul 21 '06 #3
Rik
rlee0001 wrote:
Well if you have a database then that would be a good place to start.
If you are not currently using a database you could store the
relationships in an include file and include_once it into each page.

For a database I would do something like:

"id","pagename","parent_id"
1,"Home",0
2,"Introduction",1
3,"History",1
4,"Timetable",1
5,"Semester1",4
6,"Semester2",4
...

Then use a recursive function to "walk" up and down the tree:

function printnode($node) {
if ($node->parent_id) {
printnode(getNode($node->parent_id));
}
echo $node->pagename;
return;
}
If you want breadcrumbs, with a hierarchical table, it might be worth it to
use the nested set model instead of the adjacency model:

http://dev.mysql.com/tech-resources/...ical-data.html

Grtz,
--
Rik Wasmus
Jul 21 '06 #4
I've always thought of breadcrumbs as a representation of where you
have been, to answer the wuestion 'How did I get here?'. A kinda fancy
way to show a users history within your website's domain. Breadcrumbs
are named such as a reference to the fairy tale of hansel & gretal
(spell?). They left breadcrumbs on the trail the took to know how to
get back....

What you are talking about I would call a directory or page heirarchy.
cr*********@yahoo.com wrote:
Hi everybody,

I want to create dynamic breadcrumbs for a site I am developing. I just
want to get some views about the algorithm of breadcrumbs.

The way I look at it is the concept of parent/ child (main/ sub). I
have the "Home" page, which has links to sub-pages such as
"Introduction", "History", "Timetable", etc. Each page can have other
sub-pages, such as "Timetable" can have "Semester1", "Semester2", etc.
This is how I'd initially think. Am I on the right track? If yes, how
do I proceed? Do I need a database or is there another efficient way to
do it? If it is in fact the way I am thinking, then I think I need a
way to "register" or hold the data in some way and access it on each
page. I'm just lost here.

Please push me to the right direction.

Thanks
Ben
Jul 21 '06 #5

Colin wrote:
I've always thought of breadcrumbs as a representation of where you
have been, to answer the wuestion 'How did I get here?'. A kinda fancy
way to show a users history within your website's domain. Breadcrumbs
are named such as a reference to the fairy tale of hansel & gretal
(spell?). They left breadcrumbs on the trail the took to know how to
get back....

What you are talking about I would call a directory or page heirarchy.
Well I think these are the two varieties that bread crumbs come in. I
guess which one an author chooses is based on his own tastes and how he
expects his site to be used.

Personally I find history-based breadbrumbs pointless. Why do I need a
link to where I've already been? Wouldn't I just use the back button?

Heirarchy breadcrumbs are very useful not only for navigation but also
for orientation.

-Robert
cr*********@yahoo.com wrote:
Hi everybody,

I want to create dynamic breadcrumbs for a site I am developing. I just
want to get some views about the algorithm of breadcrumbs.

The way I look at it is the concept of parent/ child (main/ sub). I
have the "Home" page, which has links to sub-pages such as
"Introduction", "History", "Timetable", etc. Each page can have other
sub-pages, such as "Timetable" can have "Semester1", "Semester2", etc.
This is how I'd initially think. Am I on the right track? If yes, how
do I proceed? Do I need a database or is there another efficient way to
do it? If it is in fact the way I am thinking, then I think I need a
way to "register" or hold the data in some way and access it on each
page. I'm just lost here.

Please push me to the right direction.

Thanks
Ben
Jul 21 '06 #6
JDS
On Fri, 21 Jul 2006 09:57:33 -0700, Colin wrote:
What you are talking about I would call a directory or page heirarchy.
See, now, I've always interpreted breadcrumbs to be a fixed directory
hiearchy, and have nothing to do with the user's current browsing session.

Home Products Gizmos Rotating Sprockets

Makes sense to me that that thing there is a representation of the
website's hiearchy.
Although I can understand the "user's current browsing session" type of
breadcrumb implementation.

Of course, the two styles of breadcrumb require quite different
implementations.

Also, one of the things I don't like about the "current session" style of
breadcrumb is the logic problems: what happens when I browse from "Home"
to "Gizmos" to "Right Handed Doohickeys" and then back to "Gizmos"? But
just clicking on links, not using the breadcrumb itself. Does the
breadcrumb look like this?:

Home Gizmos Right Handed Doohickeys Gizmos

Huh? What then? Also, what if the person comes in directly to the Right
Handed Doohickeys page from an outside page, say, a search? Does "RHD's"
get the top billing in the breadcrumb?

(Breadcrumb):

Right Handed Doohickeys

For me, those sorts of issues make it most sensible to stick with the
"breadcrumb as website hiearchy" model.

Also, on that note, the "breadcrumb" need not necessarily have anything to
do with the "URL". When I have implemented breadcrumbs, it has always
been with the use of a data flag -- in a database or in the page code --
that indicates, "This page's parent page is XXXX". In the case of
"Rotating Sprockets" or "Right Handed Doohickeys", the flag would be equal
to "Gizmos" (or, rather, the unique identifier for the page "Gizmos").

Using "parent page" identifiers, one can build the breadcrumb recursively
all the way back up to "Home".

later...

--
JDS

Jul 21 '06 #7
I built a system a couple years ago and encountered these issues as
well. I began to see links in a web site as a directed graph
(http://en.wikipedia.org/wiki/Graph_theory). Breadcrumbs then become
semantically meaningful subgraphs. The meaning is the god's eye view
(webmaster's) and provided as a navigational aid to users. It's not at
all the same as what the user actually did to get from A to B (which may
have been a terribly convoluted route). It's also not meant to be a
comprehensive fully-connected graph (there may be many ways to reach
certain pages, but you select only the more important ones as breadcrumbs).

So "breadcrumb" is really a poor name for this thing. A cairn-marked
trail is probably more accurate.

I settled on a recursive method which allows the webmaster to fully
control the tree (move things around, add nodes, delete subtrees, etc.)

Because of this potential for movement, I decided also -- deliberately
-- not to encode the page's hierarchy anywhere in its URL. Best to make
the URL blind to the breadcrumb navigation in my experience. Give every
page a unique numerical identifier, I think, but make it flat.

JDS wrote:
On Fri, 21 Jul 2006 09:57:33 -0700, Colin wrote:
>What you are talking about I would call a directory or page heirarchy.

See, now, I've always interpreted breadcrumbs to be a fixed directory
hiearchy, and have nothing to do with the user's current browsing session.

Home Products Gizmos Rotating Sprockets

Makes sense to me that that thing there is a representation of the
website's hiearchy.
Although I can understand the "user's current browsing session" type of
breadcrumb implementation.

Of course, the two styles of breadcrumb require quite different
implementations.

Also, one of the things I don't like about the "current session" style of
breadcrumb is the logic problems: what happens when I browse from "Home"
to "Gizmos" to "Right Handed Doohickeys" and then back to "Gizmos"? But
just clicking on links, not using the breadcrumb itself. Does the
breadcrumb look like this?:

Home Gizmos Right Handed Doohickeys Gizmos

Huh? What then? Also, what if the person comes in directly to the Right
Handed Doohickeys page from an outside page, say, a search? Does "RHD's"
get the top billing in the breadcrumb?

(Breadcrumb):

Right Handed Doohickeys

For me, those sorts of issues make it most sensible to stick with the
"breadcrumb as website hiearchy" model.

Also, on that note, the "breadcrumb" need not necessarily have anything to
do with the "URL". When I have implemented breadcrumbs, it has always
been with the use of a data flag -- in a database or in the page code --
that indicates, "This page's parent page is XXXX". In the case of
"Rotating Sprockets" or "Right Handed Doohickeys", the flag would be equal
to "Gizmos" (or, rather, the unique identifier for the page "Gizmos").

Using "parent page" identifiers, one can build the breadcrumb recursively
all the way back up to "Home".

later...
Jul 21 '06 #8
JDS wrote:
Using "parent page" identifiers, one can build the breadcrumb recursively
all the way back up to "Home".
What about situations where a page can have multiple parent's
i.e a product could be under a 'On Sale' section and under its stardard
product type section

As a sidepoint, I'm not trying to defend the use of history style
breadcrumbs, just point them out as an alternative that SOME have used.
Honestly, i find history-style breadcrumbs pointless. Just use the back
button (as someone else has mentioned).
Another modern alternative has been the use of TAGS to associate items
within not conflicting groups. i.e. a product can be in multiple groups
that are not of the same hierarchy.

the whole subject we are talking about here is called (or at least I
would call it) Information Architecture (O'reilly has a book on this
subject called "Information Architecture for the Web")

Jul 22 '06 #9
Colin wrote:
JDS wrote:
Using "parent page" identifiers, one can build the breadcrumb recursively
all the way back up to "Home".

What about situations where a page can have multiple parent's
i.e a product could be under a 'On Sale' section and under its stardard
product type section

As a sidepoint, I'm not trying to defend the use of history style
breadcrumbs, just point them out as an alternative that SOME have used.
Honestly, i find history-style breadcrumbs pointless. Just use the back
button (as someone else has mentioned).
Another modern alternative has been the use of TAGS to associate items
within not conflicting groups. i.e. a product can be in multiple groups
that are not of the same hierarchy.

the whole subject we are talking about here is called (or at least I
would call it) Information Architecture (O'reilly has a book on this
subject called "Information Architecture for the Web")
I once did a site where peer navigation was expected at multiple
levels. So I did a nav bar something like this

---------------------------------------------------
HOME
toplevel1 TOPLEVEL2 toplevel3
level2choice1 level2choice2 level2choice3 LEVEL2CHOICE4
level2choice5
L2C4OPTION1 l2c4option2
---------------------------------------------------

In this example, user went home-->level2--->choice4--->option1.

Jul 27 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1490
by: JC Mugs | last post by:
I am having a conceptual problem. When working with a forms & Code sections which is correct method and how do they differ when working with fields? Code Private Sub CExt1_BeforeUpdate(Cancel...
3
2493
by: Natan Vivo | last post by:
Hi everybody! I am planning to create a kind of text editor that you can insert objects in the middle of the text, much like you insert WordArt or vector graphics inside a MS Word document. You...
1
702
by: omar | last post by:
im migrating from asp to asp.net. im a bit confused about form authentication in ASP.NET ... in ASP if I wanted to create a login application I would simply query the db for the username and...
171
7577
by: tshad | last post by:
I am just trying to decide whether to split my code and uses code behind. I did it with one of my pages and found it was quite a bit of trouble. I know that most people (and books and articles)...
1
995
by: rodchar | last post by:
hey all, can someone give me a definition for dummies for the following: <html> <meta http-equiv="refresh" content="5;url=http://localhost/helloworld.htm" /> what's the concept behind the...
3
3720
by: NUPUL | last post by:
Hi, Say I wish to create my own library of certain classes/methods (for Linux/Windows/Solaris) and give the corresponding bindings in C++. How do I go about it? Are there special "library"...
2
2797
by: shiva359 | last post by:
Hi , could someone throw some light on why do default software when installed ( as root for creating an instance leaves us with some world accessable directories & some ...
0
1526
by: Naveen Mundru | last post by:
This is sitemap But I am unable to connect <?xml version="1.0" encoding="utf-8" ?> <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" > <siteMapNode url="webform1.aspx"...
0
7040
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6905
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7080
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6736
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5331
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4772
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
2994
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
561
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
178
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.