C and S Design.
Search Friendly Programming and Design



Get this Code: Click to download the ASP file.
Do not copy and paste the displayed code. The display function adds line breaks so what you see is definitely not what you would get.

Code for this Example. (Breadcrumb Trail)

<%

sub CrumbTrail()
dim ThisPath
dim bShow
dim i
dim j

ThisPath = _ 
	Split(Request.ServerVariables("PATH_INFO"), _ 
	"/")
if ubound(ThisPath) > 1 then
with response
	.write "Go to -> "
	for i = 1 to ubound(ThisPath) - 1
		bShow = False
		if instr(ThisPath(i),".asp") = 0 then bShow = _ 
	True
			if bShow then
				.write "<a href="
				.write chr(34)
				.write "/"
				for j = 1 to i
				.write ThisPath(j)
				.write "/"
				next
				.write chr(34)
				.write " title="
				.write chr(34)
				.write "Go to "
				.write CodeNav(ThisPath(i))
				.write " page"
				.write chr(34)
				.write ">"
				.write CodeNav(ThisPath(i))
				.write "</a>" & vbCrLf
		if i <> ubound(ThisPath) - 1 then .write " _ 
	-> " & vbCrLf
			end if
	next
end with
end if
end sub

function CodeNav(strIn)
CodeNav = replace(strIn,"-"," ")
CodeNav = Proper(CodeNav)
CodeNav = UpperWord(CodeNav,"css")
CodeNav = UpperWord(CodeNav,"html")
CodeNav = UpperWord(CodeNav,"asp")
CodeNav = UpperWord(CodeNav,"php")
CodeNav = UpperWord(CodeNav,"seo")
CodeNav = UpperWord(CodeNav,"iis")
end function

sub CodeTrail()
with response
	.write "<div id="
	.write chr(34)
	.write "crumbtrail"
	.write chr(34)
	.write ">" & vbCrLf
CrumbTrail()
if bNoSiteNav or bShowScript then
	.write " -> "
	.write "<a href="
	.write chr(34)
	.write "show-code.asp"
	.write chr(34)
	.write " title="
	.write chr(34)
	.write "Show Code for this "
	.write replace(GetPagePath(),"-"," ")
	.write " layout"
	.write chr(34)
	.write ">"
	.write "Show Code"
	.write "</a>" & vbCrLf
end if
	.write "</div>"  & vbCrLf
	.write " <!-- "
	.write "crumbtrail"
	.write " -->" & vbCrLf
end with
end sub

function Proper(strText)
dim words
dim i
words = Split(strText," ")
for i = 0 to ubound(words)
	words(i) = Capitalise(words(i))
next
for i = 0 to ubound(words)
	if i > 0 then
		Proper = Proper & " " & words(i)
	else
		Proper = Proper & words(i)
	end if	
next
end function

' capitalise first letter of string sent
function Capitalise(strText)
Capitalise = ucase(left(strText,1)) & lcase(mid(strText,2))
end function

function GetPagePath()
dim ThisPath
ThisPath = _ 
	Split(Request.ServerVariables("PATH_INFO"), _ 
	"/")
GetPagePath = ThisPath(ubound(ThisPath)-1)
end function

function UpperWord(strIn,Word)
' function to
	dim RegEx
	set RegEx = New RegExp
	RegEx.Pattern = "\b(" & Word & ")\b"
	RegEx.IgnoreCase = true
	RegEx.Global = True
	UpperWord = RegEx.replace(strIn, ucase(word))
	set regEx = nothing
end function

%>



Valid HTML 4.01! Valid CSS! copyright © C and S Design 2004 - 2005
Website Design and SE Friendly Coding C and S Design