Wrox Programmer Forums
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 17th, 2005, 01:38 PM
Registered User
 
Join Date: Aug 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Breadcrumb Navigation with ASP

Hi all,

Don't know if anyone can help but I'm trying to create and automatic breadcrumb navigation
so that users can see where that are with in the site and where they have been for example:

Your are Here: Home>BR>Helpdesk>Contacts

Here is the code I am using:

First, I place these two lines at the very top of my ASP page--above all other lines of code:


<% PageTitle = "Bread Crumb Example Page" %>


Then I replace the <title> tags with this code:

<title><% = PageTitle %></title>

Then I place this code where I want the bread crumb navigation to appear:

<% = TWDbreadcrumb_navigation(Request.ServerVariables(" PATH_INFO")) %>

Finally, I create an ASP page with ONLY this code in it; naming it "breadcrumb_navigation.asp" and put it into my "includes" folder:

<%
Function TWDbreadcrumb_navigation(FullPath)
Do Until instr(1,FullPath,"/") = 0
Letters =

array("a","b","c","d","e","f","g","h","i","j","k", "l","m","n","o","p","q","r","s","t","u","v","w","x "

,"y","z")
tmpPath = mid(FullPath,1,instr(1,FullPath,"/")-1)
strTmpPath = Trim(tmpPath)
DirPath = DirPath & strTmpPath & "/"
firstLetter = ucase(mid(strTmpPath,1,1))
strTmpPath = firstLetter & mid(strTmpPath,2,len(strTmpPath))
for each letter in letters
strTmpPath = Replace(Trim(strTmpPath),"_" & lcase(letter)," " & UCase(letter))
next
FullPath = mid(FullPath,instr(1,FullPath,"/")+1,Len(FullPath)-Len(tmpPath))
IF strTmpPath = "" THEN
response.write "<a href=""/"" style=""text-decoration:none"">Home</a>"
ELSEIF strTmpPath = "Home" THEN
ELSE
response.write " &gt; <a href=""" & DirPath & """ style=""text-decoration:none"">" & strTmpPath &

"</a>"
END IF
Loop
IF PageTitle = "" THEN
response.write "<b>" & " : Current Page " & "</b>"<br>
ELSE
response.write "<b style=""color: #800000"">" & " : " & PageTitle & "</b>"
END IF
End Function
%>

The only problem is I get this error message and I don't know why!

Error message:


Microsoft VBScript compilation error '800a03ea'

Syntax error

/br/helpdesk/breadcrumb_navigation.asp, line 22

response.write "<b>" & " : Current Page " & "</b>"<br>
------------------------------------------------------^

Help Please.... It's driving me mad!

Thanks in Advance, John :-)



 
Old February 17th, 2005, 07:59 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 344
Thanks: 0
Thanked 1 Time in 1 Post
Default

Change :

response.write "<b>" & " : Current Page " & "</b>"<br>

to :

response.write "<b>" & " : Current Page " & "</b><br>"

so that the <br> is actually in the string rather than outide so it is processed by the RESPONSE.WRITE function and not seen as some random VBScript var.
 
Old February 23rd, 2005, 08:55 AM
Registered User
 
Join Date: Aug 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Greg,

Your a star mate - can't believe I've been so stupid in missing that!

Thanks for your help, it's much appreciated!!!

Cheers
John :)

 
Old March 9th, 2005, 10:05 PM
Registered User
 
Join Date: Mar 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Check this article http://www.asp101.com/articles/jason...ar/default.asp

Mo





Similar Threads
Thread Thread Starter Forum Replies Last Post
asp/Access recordset navigation query murshed Classic ASP Databases 1 April 10th, 2008 01:43 PM
navigation (ch7 of Beg.ASP.NET3.5) wingri ASP.NET 3.5 Basics 3 April 7th, 2008 12:46 AM
how to add breadcrumb navigation to a LAMP site avail1now PHP How-To 0 February 17th, 2006 05:03 PM
Breadcrumb bluemat XSLT 2 October 7th, 2004 04:43 AM
ASP Navigation not working????? bushbird Classic ASP Databases 1 August 20th, 2003 01:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.