|
 |
asp_web_howto thread: Breadcrumb trials
Message #1 by "Jeff McFarland" <jeff@s...> on Fri, 15 Jun 2001 14:46:02
|
|
I am trying to create a "breadcrumb trial" on my site, but am a little
unsure where to start. Does anyone know of a good tutorial or something
to get me started?
Thanks!!
Message #2 by "Morgan, Rob" <Rob.Morgan@o...> on Fri, 15 Jun 2001 09:45:17 -0400
|
|
Here is one I just got done putting together.
Function fGet_Left_Nav()
Dim fsMyFSO ' File System Object
Dim fileLeftNavSource ' File Object, text file source for tab
contents
Dim intLineCount ' line count of source file
Dim intCounter ' line count of source file
Dim strLeftNav '
Dim strLeftNavFile '
' File access constants
Const ForReading =3D 1
Const TristateFalse =3D 0
strLeftNav =3D ""
intLineCount =3D 1
=09
'Instantiate the file system object
Set fsMyFSO =3D CreateObject("Scripting.FileSystemObject")
'using the file system's GetFile, initialize the file object
strSrcFilePath =3D Left(Request.ServerVariables("PATH_TRANSLATED"),
InStrRev(Request.ServerVariables("PATH_TRANSLATED"),"\"))
strLeftNavFile =3D "left_nav.txt"
=09
'check for the left_nav file before trying to process it
if fsMyFSO.FileExists(strSrcFilePath & strLeftNavFile) then
Set fileLeftNavSource =3D fsMyFSO.OpenTextFile(strSrcFilePath
& strLeftNavFile)
strLeftNav =3D "<td width=3D'130' height=3D'335' align=3D'center'
valign=3D'top' background=3D'http://" & strDomain_Name &
"/images/leftbarbig.gif'><font class=3D'leftNavReg'>"
Do While Not fileLeftNavSource.AtEndOfStream
strLeftNav =3D strLeftNav + " <a href=3D'" +
trim(fileLeftNavSource.ReadLine) + "'>" +
Trim(fileLeftNavSource.ReadLine) +
"</a><br><br>" + vbCrLf
Loop
strLeftNav =3D strLeftNav + "</font></td>"
=09
' Cleanup and dispose of objects
fileLeftNavSource.Close
Set fileLeftNavSource =3D nothing
Set fsMyFSO =3D nothing
end if=09
fGet_Left_Nav =3D strLeftNav
End Function
-----Original Message-----
From: Jeff McFarland [mailto:jeff@s...]
Sent: Friday, June 15, 2001 10:46 AM
To: ASP Web HowTo
Subject: [asp_web_howto] Breadcrumb trials
I am trying to create a "breadcrumb trial" on my site, but am a little
unsure where to start. Does anyone know of a good tutorial or
something
to get me started?
Thanks!!
Message #3 by "Jeff McFarland" <jeff@s...> on Fri, 15 Jun 2001 16:51:09
|
|
Wow...thanks for the help!! This is a great start! Now how do I
implement this code? Do you have a sample URL to see this code in action?
Thanks Again!
> Here is one I just got done putting together.
>
> Function fGet_Left_Nav()
> Dim fsMyFSO ' File System Object
> Dim fileLeftNavSource ' File Object, text file source for
tab
> contents
> Dim intLineCount ' line count of source file
> Dim intCounter ' line count of source file
> Dim strLeftNav '
> Dim strLeftNavFile '
>
>
> ' File access constants
> Const ForReading =3D 1
> Const TristateFalse =3D 0
>
> strLeftNav =3D ""
> intLineCount =3D 1
> =09
> 'Instantiate the file system object
> Set fsMyFSO =3D CreateObject("Scripting.FileSystemObject")
>
> 'using the file system's GetFile, initialize the file object
> strSrcFilePath =3D Left(Request.ServerVariables("PATH_TRANSLATED"),
> InStrRev(Request.ServerVariables("PATH_TRANSLATED"),"\"))
> strLeftNavFile =3D "left_nav.txt"
> =09
> 'check for the left_nav file before trying to process it
> if fsMyFSO.FileExists(strSrcFilePath & strLeftNavFile) then
> Set fileLeftNavSource =3D fsMyFSO.OpenTextFile
(strSrcFilePath
> & strLeftNavFile)
>
> strLeftNav =3D "<td width=3D'130' height=3D'335'
align=3D'center'
> valign=3D'top' background=3D'http://" & strDomain_Name &
> "/images/leftbarbig.gif'><font class=3D'leftNavReg'>"
> Do While Not fileLeftNavSource.AtEndOfStream
> strLeftNav =3D strLeftNav + " <a href=3D'" +
> trim(fileLeftNavSource.ReadLine) + "'>" +
> Trim(fileLeftNavSource.ReadLine) +
> "</a><br><br>" + vbCrLf
> Loop
> strLeftNav =3D strLeftNav + "</font></td>"
> =09
> ' Cleanup and dispose of objects
> fileLeftNavSource.Close
> Set fileLeftNavSource =3D nothing
> Set fsMyFSO =3D nothing
> end if=09
>
> fGet_Left_Nav =3D strLeftNav
>
> End Function
>
Message #4 by "Morgan, Rob" <Rob.Morgan@o...> on Fri, 15 Jun 2001 12:29:10 -0400
|
|
Doh, oops, I just noticed that I gave you the wrong code. :) Keep it If
you
want to load a text file to create a left menu bar. I'm not done with
my
page yet but the url for it is http://www.ohioed.org/
Here is the right function...
Function BreadCrumb()
Dim FullPath, bread, intCount, aPath, pathArr,i
aPath =3D lcase(Request.ServerVariables("Path_Info"))
pathArr =3D Split(aPath, "/")
IF uBound(pathArr) > 0 Then
For i =3D 1 to uBound(pathArr) - 1
'Offset page Name
FullPath =3D FullPath & pathArr(i) & "/"
intCount =3D intCount + (len(pathArr(i)) + 3)
'count the words to see how long the trail will be
if intCount < 100 then
'stops the trail if it get too long
bread =3D bread & "<a href=3D'http://" & strDomain_Name
bread =3D bread & "/" & FullPath & "'>" & pathArr(i) &
"</a>"
if i <> uBound(pathArr)- 1 then
bread =3D bread & "<font color=3D'#c0c0c0'> > </font>"
end if
end if =09
Next
response.write bread
Else
response.write "Home"
End IF
End Function
Make an asp page called function.asp and put the above funtion in it.
Make another page call test.asp. in test.asp put the following lines
<!--#include virtual=3D"function.asp"-->
call BreadCrumb
-----Original Message-----
From: Jeff McFarland [mailto:jeff@s...]
Sent: Friday, June 15, 2001 12:51 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Breadcrumb trials
Wow...thanks for the help!! This is a great start! Now how do I
implement this code? Do you have a sample URL to see this code in
action?
Thanks Again!
> Here is one I just got done putting together.
>
> Function fGet_Left_Nav()
> Dim fsMyFSO ' File System Object
> Dim fileLeftNavSource ' File Object, text file source for
tab
> contents
> Dim intLineCount ' line count of source file
> Dim intCounter ' line count of source file
> Dim strLeftNav '
> Dim strLeftNavFile '
>
>
> ' File access constants
> Const ForReading =3D3D 1
> Const TristateFalse =3D3D 0
>
> strLeftNav =3D3D ""
> intLineCount =3D3D 1
> =3D09
> 'Instantiate the file system object
> Set fsMyFSO =3D3D CreateObject("Scripting.FileSystemObject")
>
> 'using the file system's GetFile, initialize the file object
> strSrcFilePath =3D3D
Left(Request.ServerVariables("PATH_TRANSLATED"),
> InStrRev(Request.ServerVariables("PATH_TRANSLATED"),"\"))
> strLeftNavFile =3D3D "left_nav.txt"
> =3D09
> 'check for the left_nav file before trying to process it
> if fsMyFSO.FileExists(strSrcFilePath & strLeftNavFile) then
> Set fileLeftNavSource =3D3D fsMyFSO.OpenTextFile
(strSrcFilePath
> & strLeftNavFile)
>
> strLeftNav =3D3D "<td width=3D3D'130' height=3D3D'335'
align=3D3D'center'
> valign=3D3D'top' background=3D3D'http://" & strDomain_Name &
> "/images/leftbarbig.gif'><font class=3D3D'leftNavReg'>"
> Do While Not fileLeftNavSource.AtEndOfStream
> strLeftNav =3D3D strLeftNav + " <a href=3D3D'" +
> trim(fileLeftNavSource.ReadLine) + "'>" + =3D
> Trim(fileLeftNavSource.ReadLine) +
> "</a><br><br>" + vbCrLf
> Loop
> strLeftNav =3D3D strLeftNav + "</font></td>"
> =3D09
> ' Cleanup and dispose of objects
> fileLeftNavSource.Close
> Set fileLeftNavSource =3D3D nothing
> Set fsMyFSO =3D3D nothing
> end if=3D09
>
> fGet_Left_Nav =3D3D strLeftNav
>
> End Function
>
Message #5 by "Jeff McFarland" <jeff@s...> on Mon, 18 Jun 2001 14:07:50
|
|
Hi! I really appreciate your help with this breadcrumb trial! Well, I
have cut and pasted your code, and all seems to be worked (for the most
part). Except the breadcrumb trial only displays one thing...no matter
what page I go to? Let me first ask you a question? Will I need to
change the "Breadcrumb Function" for every page that I include it on, or
is the function suppose to just keep track of the URL path itself? If I
do have the change the function for every different page, where do I
change it at? Also, if you don't mind, you can just email me at
jeff@s... so that this process might take a little less time. But
don't worry, I will post your results so everyone can see.
Thanks,
Jeff
> Doh, oops, I just noticed that I gave you the wrong code. :) Keep it If
> you
> want to load a text file to create a left menu bar. I'm not done with
> my
> page yet but the url for it is http://www.ohioed.org/
>
> Here is the right function...
>
> Function BreadCrumb()
> Dim FullPath, bread, intCount, aPath, pathArr,i
> aPath =3D lcase(Request.ServerVariables("Path_Info"))
> pathArr =3D Split(aPath, "/")
> IF uBound(pathArr) > 0 Then
> For i =3D 1 to uBound(pathArr) - 1
> 'Offset page Name
> FullPath =3D FullPath & pathArr(i) & "/"
> intCount =3D intCount + (len(pathArr(i)) + 3)
> 'count the words to see how long the trail will be
> if intCount < 100 then
> 'stops the trail if it get too long
> bread =3D bread & "<a href=3D'http://" &
strDomain_Name
> bread =3D bread & "/" & FullPath & "'>" & pathArr(i) &
> "</a>"
> if i <> uBound(pathArr)- 1 then
> bread =3D bread & "<font color=3D'#c0c0c0'> >
</font>"
> end if
> end if =09
> Next
> response.write bread
> Else
> response.write "Home"
> End IF
> End Function
>
>
>
> Make an asp page called function.asp and put the above funtion in it.
> Make another page call test.asp. in test.asp put the following lines
>
> <!--#include virtual=3D"function.asp"-->
> call BreadCrumb
>
>
>
>
>
> -----Original Message-----
> From: Jeff McFarland [mailto:jeff@s...]
> Sent: Friday, June 15, 2001 12:51 PM
> To: ASP Web HowTo
> Subject: [asp_web_howto] RE: Breadcrumb trials
>
>
> Wow...thanks for the help!! This is a great start! Now how do I
> implement this code? Do you have a sample URL to see this code in
> action?
>
> Thanks Again!
>
> > Here is one I just got done putting together.
> >
> > Function fGet_Left_Nav()
> > Dim fsMyFSO ' File System Object
> > Dim fileLeftNavSource ' File Object, text file source for
> tab
> > contents
> > Dim intLineCount ' line count of source file
> > Dim intCounter ' line count of source file
> > Dim strLeftNav '
> > Dim strLeftNavFile '
> >
> >
> > ' File access constants
> > Const ForReading =3D3D 1
> > Const TristateFalse =3D3D 0
> >
> > strLeftNav =3D3D ""
> > intLineCount =3D3D 1
> > =3D09
> > 'Instantiate the file system object
> > Set fsMyFSO =3D3D CreateObject("Scripting.FileSystemObject")
> >
> > 'using the file system's GetFile, initialize the file object
> > strSrcFilePath =3D3D
> Left(Request.ServerVariables("PATH_TRANSLATED"),
> > InStrRev(Request.ServerVariables("PATH_TRANSLATED"),"\"))
> > strLeftNavFile =3D3D "left_nav.txt"
> > =3D09
> > 'check for the left_nav file before trying to process it
> > if fsMyFSO.FileExists(strSrcFilePath & strLeftNavFile) then
> > Set fileLeftNavSource =3D3D fsMyFSO.OpenTextFile
> (strSrcFilePath
> > & strLeftNavFile)
> >
> > strLeftNav =3D3D "<td width=3D3D'130' height=3D3D'335'
> align=3D3D'center'
> > valign=3D3D'top' background=3D3D'http://" & strDomain_Name &
> > "/images/leftbarbig.gif'><font class=3D3D'leftNavReg'>"
> > Do While Not fileLeftNavSource.AtEndOfStream
> > strLeftNav =3D3D strLeftNav + " <a
href=3D3D'" +
> > trim(fileLeftNavSource.ReadLine) + "'>" + =3D
> > Trim(fileLeftNavSource.ReadLine) +
> > "</a><br><br>" + vbCrLf
> > Loop
> > strLeftNav =3D3D strLeftNav + "</font></td>"
> > =3D09
> > ' Cleanup and dispose of objects
> > fileLeftNavSource.Close
> > Set fileLeftNavSource =3D3D nothing
> > Set fsMyFSO =3D3D nothing
> > end if=3D09
> >
> > fGet_Left_Nav =3D3D strLeftNav
> >
> > End Function
> >
Message #6 by "Jeff McFarland" <jeff@s...> on Mon, 18 Jun 2001 10:47:32 -0400
|
|
Rob,
I have everything working! With this script what do you do if there is a
cross referenced page or some type of dynamic page that is build and doesn't
really belong in a certain one subdirectory?
Thanks again for your help, if there might be any way that I can help
you...please let me know.
Thx,
Jeff
----- Original Message -----
From: "Morgan, Rob" <Rob.Morgan@o...>
To: <jeff@s...>
Sent: Monday, June 18, 2001 10:43 AM
Subject: RE: [asp_web_howto] RE: Breadcrumb trials
> You should not have to modify the function for each page you include it
on.
> It should read the path to the current script running, that's what
> Request.ServerVariables("Path_Info") does. You could make a test page and
> add in a few response.writes to check the apath and fullpath variables.
>
> Rob
>
> -----Original Message-----
> From: Jeff McFarland
> To: ASP Web HowTo
> Sent: 6/18/01 10:07 AM
> Subject: [asp_web_howto] RE: Breadcrumb trials
>
> Hi! I really appreciate your help with this breadcrumb trial! Well, I
> have cut and pasted your code, and all seems to be worked (for the most
> part). Except the breadcrumb trial only displays one thing...no matter
> what page I go to? Let me first ask you a question? Will I need to
> change the "Breadcrumb Function" for every page that I include it on, or
>
> is the function suppose to just keep track of the URL path itself? If I
>
> do have the change the function for every different page, where do I
> change it at? Also, if you don't mind, you can just email me at
> jeff@s... so that this process might take a little less time. But
>
> don't worry, I will post your results so everyone can see.
>
> Thanks,
>
> Jeff
>
> > Doh, oops, I just noticed that I gave you the wrong code. :) Keep it
> If
> > you
> > want to load a text file to create a left menu bar. I'm not done with
>
> > my
> > page yet but the url for it is http://www.ohioed.org/
> >
> > Here is the right function...
> >
> > Function BreadCrumb()
> > Dim FullPath, bread, intCount, aPath, pathArr,i
> > aPath =3D lcase(Request.ServerVariables("Path_Info"))
> > pathArr =3D Split(aPath, "/")
> > IF uBound(pathArr) > 0 Then
> > For i =3D 1 to uBound(pathArr) - 1
> > 'Offset page Name
> > FullPath =3D FullPath & pathArr(i) & "/"
> > intCount =3D intCount + (len(pathArr(i)) + 3)
> > 'count the words to see how long the trail will be
> > if intCount < 100 then
> > 'stops the trail if it get too long
> > bread =3D bread & "<a href=3D'http://" &
> strDomain_Name
> > bread =3D bread & "/" & FullPath & "'>" & pathArr(i)
> &
> > "</a>"
> > if i <> uBound(pathArr)- 1 then
> > bread =3D bread & "<font color=3D'#c0c0c0'> >
> </font>"
> > end if
> > end if =09
> > Next
> > response.write bread
> > Else
> > response.write "Home"
> > End IF
> > End Function
> >
> >
> >
> > Make an asp page called function.asp and put the above funtion in it.
> > Make another page call test.asp. in test.asp put the following lines
> >
> > <!--#include virtual=3D"function.asp"-->
> > call BreadCrumb
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: Jeff McFarland [mailto:jeff@s...]
> > Sent: Friday, June 15, 2001 12:51 PM
> > To: ASP Web HowTo
> > Subject: [asp_web_howto] RE: Breadcrumb trials
> >
> >
> > Wow...thanks for the help!! This is a great start! Now how do I
> > implement this code? Do you have a sample URL to see this code in
> > action?
> >
> > Thanks Again!
> >
> > > Here is one I just got done putting together.
> > >
> > > Function fGet_Left_Nav()
> > > Dim fsMyFSO ' File System Object
> > > Dim fileLeftNavSource ' File Object, text file source
> for
> > tab
> > > contents
> > > Dim intLineCount ' line count of source file
> > > Dim intCounter ' line count of source file
> > > Dim strLeftNav '
> > > Dim strLeftNavFile '
> > >
> > >
> > > ' File access constants
> > > Const ForReading =3D3D 1
> > > Const TristateFalse =3D3D 0
> > >
> > > strLeftNav =3D3D ""
> > > intLineCount =3D3D 1
> > > =3D09
> > > 'Instantiate the file system object
> > > Set fsMyFSO =3D3D CreateObject("Scripting.FileSystemObject")
> > >
> > > 'using the file system's GetFile, initialize the file object
> > > strSrcFilePath =3D3D
> > Left(Request.ServerVariables("PATH_TRANSLATED"),
> > > InStrRev(Request.ServerVariables("PATH_TRANSLATED"),"\"))
> > > strLeftNavFile =3D3D "left_nav.txt"
> > > =3D09
> > > 'check for the left_nav file before trying to process it
> > > if fsMyFSO.FileExists(strSrcFilePath & strLeftNavFile) then
> > > Set fileLeftNavSource =3D3D fsMyFSO.OpenTextFile
> > (strSrcFilePath
> > > & strLeftNavFile)
> > >
> > > strLeftNav =3D3D "<td width=3D3D'130'
> height=3D3D'335'
> > align=3D3D'center'
> > > valign=3D3D'top' background=3D3D'http://" & strDomain_Name &
> > > "/images/leftbarbig.gif'><font class=3D3D'leftNavReg'>"
> > > Do While Not fileLeftNavSource.AtEndOfStream
> > > strLeftNav =3D3D strLeftNav + " <a
> href=3D3D'" +
> > > trim(fileLeftNavSource.ReadLine) + "'>" + =3D
> > > Trim(fileLeftNavSource.ReadLine) +
> > > "</a><br><br>" + vbCrLf
> > > Loop
> > > strLeftNav =3D3D strLeftNav + "</font></td>"
> > > =3D09
> > > ' Cleanup and dispose of objects
> > > fileLeftNavSource.Close
> > > Set fileLeftNavSource =3D3D nothing
> > > Set fsMyFSO =3D3D nothing
> > > end if=3D09
> > >
> > > fGet_Left_Nav =3D3D strLeftNav
> > >
> > > End Function
> > >
>
|
|
 |