SitePoint Sponsor |
|
User Tag List
Results 1 to 22 of 22
Thread: how to: navegation bar
-
Jan 15, 2005, 01:25 #1
how to: navegation bar
Hello there,
I successfully could generate a function which allow me to add as much categories and subcategories as I want. Now, I need to generate another function which could build a linked navegation bar as my sites visitores go down surfing my categories and subcategories. It's much more like the navegation bar here in this forums.
Any ideas?
Any help would be highly appreciated in advance,
Regards,
Ghz
-
Jan 15, 2005, 02:17 #2
- Join Date
- Jan 2005
- Location
- ble
- Posts
- 118
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You mean like "SitePoint Forums > Program Your Site > PHP"
And there are dotted lines are you progress?If someone was helpful, give them some 'rep'.
-
Jan 15, 2005, 03:49 #3
yes exactly, That's what I meant
Any clues?
-
Jan 15, 2005, 04:40 #4
I am also looking that.Have you got it?
-
Jan 15, 2005, 04:55 #5
not yet really. I could make a navegation bar but without being linked and as soon as I add any piece of html like links or anything else to it, it gives me an error. I'm still working on it and I wish anyone can help us never hisitate to do so.
Regards,
Ghz
-
Jan 15, 2005, 05:46 #6
Actually,I know that it can be built on java script.but looking for any php script.
I think it is good topics to do that
-
Jan 15, 2005, 15:20 #7
- Join Date
- Aug 2004
- Location
- Manchester UK
- Posts
- 13,807
- Mentioned
- 158 Post(s)
- Tagged
- 3 Thread(s)
Originally Posted by Ghz
That way we can maybe help you!!!!!
SpikeMike Swiffin - Community Team Advisor
Only a woman can read between the lines of a one word answer.....
-
Jan 18, 2005, 11:26 #8
Here is a code for you
I have made this small function so you can use it to generate a navigation bar. Feel free to use it. Now here is the code:
PHP Code:function nav_bar($id)
{
global $ecats;
$query = mysql_query("SELECT * FROM your_table WHERE id='$id'");
$row = mysql_fetch_array($query);
$cats = "<a href=index.php>{$row['title']}</a> »";
if($row['catid'] != 0) {
nav_bar($row['catid']);
}
$ecats.= $cats;
return $ecats;
}
$ecats = "";
nav_bar($id);
Regards,
Hakeem
-
Jan 18, 2005, 11:32 #9
- Join Date
- Dec 2002
- Location
- Aylmer, QC, Canada
- Posts
- 409
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
try changing
PHP Code:$cats = "<a href=index.php>{$row['title']}</a> »";
PHP Code:$cats = "<a href=index.php>".$row['title']."</a> »";
-
Jan 18, 2005, 13:50 #10
-
Jan 18, 2005, 13:56 #11
- Join Date
- Dec 2002
- Location
- Aylmer, QC, Canada
- Posts
- 409
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
doesn't {row['title']} show up when the page is displayed instead of the actual title?
-
Jan 18, 2005, 14:45 #12
Most relevant link should be on top or left, less relevant ones ones should be on right are at the bottom.
( s e o)
-
Jan 18, 2005, 15:12 #13
- Join Date
- Apr 2001
- Location
- My Computer
- Posts
- 2,808
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Just for reference, what you guys are talking about is commonly refered to as "breadcrumbs".
Try searching on that and see if you find something.
-
Jan 18, 2005, 15:26 #14
Although you haven't explicitly sais so, I assume that the data you store in your navigation table is hierarchical data, i.e. each row has a parent row. If this is the case, the doing breadcrimbs is relatively straight forward. Checkout this article http://www.sitepoint.com/article/hie...-data-database and use the modified preorder tree traversal method. All the code you need is in the article.
-
Jan 18, 2005, 17:13 #15
you can simply create a mod in php which can show sub categories.
-
Jan 19, 2005, 00:09 #16
Actually I would like to thank you guys and girls
for your participation in here. Secondly:
doesn't {row['title']} show up when the page is displayed instead of the actual title?
you can simply create a mod in php which can show sub categories
Regards,
Hakeem
-
Jan 20, 2005, 12:38 #17
- Join Date
- Mar 2001
- Location
- Hailsham, UK
- Posts
- 62
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Actually I would like to thank you guys and girls for your participation in here. Secondly:
doesn't {row['title']} show up when the page is displayed instead of the actual title?
Rgds, Ian
-
Jan 20, 2005, 23:34 #18
I found it extremely useful to create a tree class to represent these types of data structures. It accepts active id, primary field, parent field, title, id field, etc. and optionally table name and some other configuration values.
You can either create entries on the fly ($tree->add_entry) or build them automatically from a database ($tree->build()), or a combination of both. By using dynamic table and field names, you can build a tree from the table of your choice, then add and remove entries, and render it when you're done.
I plugged in a custom menu rendering method (which took AGES!), so now I can build a tree, and spit it out as either breadcrumbs OR a very robust CSS menu with infinite levels of entries, active nodes, automatic collapsing, etc. I also created a method for myGoSuMenu output, which spits out a dynamic tree-like javascript menu.
I would post some code but it's tightly coupled with my existing architecture and would be pretty useless to you. Anyway it was a great exercise in programming, I just thought I would throw some ideas out that have benefited me in my development greatly. The concepts behind a heirarchial structure like this show up all over the place in development, so this concept can really be extended to apply in a lot of places.
-
Jan 21, 2005, 19:46 #19
- Join Date
- Apr 2003
- Location
- Albany, NY
- Posts
- 417
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
First of all, that type of nav bar is called a "breadcrumb".
Do a search of phpclasses.org for the term breadcrumb and you should find some classes that will assist in making them for you.
Here's a breadcrumb class..
http://www.baskettcase.com/classes/breadcrumb/Sean P Sullivan
Web Hosting::Web Templates::Free Smilies
Free Image Hosting::DIY Home Repair::DIY Gardening::Flash Games
-
Jan 21, 2005, 19:55 #20
- Join Date
- Apr 2003
- Location
- Albany, NY
- Posts
- 417
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
As for Tekime...I use this class..
http://www.phpclasses.org/browse/package/1268.html
Works just like the one you described...I've made some modifications to it for customized use though.Sean P Sullivan
Web Hosting::Web Templates::Free Smilies
Free Image Hosting::DIY Home Repair::DIY Gardening::Flash Games
-
Feb 5, 2005, 06:10 #21
- Join Date
- Sep 2004
- Location
- India
- Posts
- 8
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
can anybody help me with a collapsible menu (vertical)??
-
Feb 9, 2005, 13:01 #22
- Join Date
- Jan 2005
- Location
- New York
- Posts
- 0
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Just use DHTML and ASP. I find it is much easier and cleaner to.
Bookmarks