Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - breadcrumb navigation trail
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

breadcrumb navigation trail

 Post Reply Post Reply
Author
tjodalv View Drop Down
Newbie
Newbie


Joined: 03 May 2006
Location: Croatia
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote tjodalv Quote  Post ReplyReply Direct Link To This Post Topic: breadcrumb navigation trail
    Posted: 03 May 2006 at 1:37pm
Hello
 
Can anyone help me with creating breadcrumb navigation trail from database table.
 
I have table tblCategory and that table have 3 fields:
 
id - unique identifier
sub_id - number
name - text
 
sub_id field holds the parent category id. How to create breadcrumb navigation trail. Google did not help me.
 
Thanks !
Tjodalv


Edited by tjodalv - 03 May 2006 at 1:38pm
Back to Top
lostcontrol View Drop Down
Groupie
Groupie


Joined: 13 January 2006
Status: Offline
Points: 58
Post Options Post Options   Thanks (0) Thanks(0)   Quote lostcontrol Quote  Post ReplyReply Direct Link To This Post Posted: 03 May 2006 at 1:45pm
I wrote this for my website... hope it helps!

Function BreadCrumb

thisEndPage=PageID_of_currently_displayed_page (variable)
    thisStartPage=PageID_of_root (constant)
   
    Do Until thisEndPage=sub_id_of_root (constant)
        set getPage=rdCon.Execute("Select * From table Where PageID="&thisEndPage&"")
        If getPage.EOF=False Then
            If thisEndPage=currently_displayed_pageID Then
                BreadCrumb=getPage("PageName")
            Else
                BreadCrumb="<a href=""#"">" &getPage("PageName")&"</a> > "&BreadCrumb
            End If
        End If
        thisEndPage=getPage("ParentID")
        getPage.Close
        set getPage=Nothing
    Loop

End Function
Back to Top
tjodalv View Drop Down
Newbie
Newbie


Joined: 03 May 2006
Location: Croatia
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote tjodalv Quote  Post ReplyReply Direct Link To This Post Posted: 03 May 2006 at 4:23pm
Thank you. That was very helpfull, it is working with simple modifications for my needs.
 

Function BreadCrumb
 strDBPath = "db1.mdb"
 
 Set dbConn = Server.CreateObject("ADODB.Connection")
 dbConn.Open "Provider=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath(strDBPath)
 
 thisEndPage = Request.QueryString("cid")
 thisStartPage = 0
 varSeparator = " > "
 
 If Request.QueryString("cid") = "" Then
  Response.Write "<a href=""default.asp"">Home</a>"
 Else
  Response.Write "<a href=""default.asp"">Home</a>" & varSeparator
 End if
    
 Do Until thisEndPage = thisStartPage
 
  set getPage = dbConn.Execute("Select * From tblCategories Where id =" & thisEndPage & ";")
        
  If NOT getPage.EOF Then
  
   If thisEndPage = Request.QueryString("cid") Then
    BreadCrumb = getPage("name")
   Else
    BreadCrumb = "<a href=""default.asp?cid=" & getPage("id") & """>" & getPage("name") & "</a>" & varSeparator & BreadCrumb
   End If
   
  End If
        
  thisEndPage = getPage("sub_id")
  getPage.Close
  set getPage = Nothing
 Loop
End Function
 
Once again, thanks !!!


Edited by tjodalv - 03 May 2006 at 4:24pm
Back to Top
lostcontrol View Drop Down
Groupie
Groupie


Joined: 13 January 2006
Status: Offline
Points: 58
Post Options Post Options   Thanks (0) Thanks(0)   Quote lostcontrol Quote  Post ReplyReply Direct Link To This Post Posted: 04 May 2006 at 2:49pm
No worries
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.