DTP


 
Lively discussions on the graphic arts and publishing — in print or on the web


Go Back   Desktop Publishing Forum > General Discussions > Web Site Building & Maintenance

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 06-21-2011, 02:42 AM   #1
LoisWakeman
Staff
 
LoisWakeman's Avatar
 
Join Date: Jan 2005
Location: Uplyme, Devon, England
Posts: 1,402
Default Classic ASP VBScript code help please!

I am using this script to make breadcrumbs from the directory structure of an ASP site.
Code:
Function BreadCrumb(FullPath)
 
Do Until instr(1,FullPath,"/") = 0
 
    '## Create an array of letters in the alphabet.
    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")
 
    '## split on the /
    tmpPath = mid(FullPath,1,instr(1,FullPath,"/")-1)
    strTmpPath = Trim(tmpPath)
    DirPath = DirPath & strTmpPath & "/"
 
    '## upshift the first character
    firstLetter = ucase(mid(strTmpPath,1,1))
    strTmpPath = firstLetter & mid(strTmpPath,2,len(strTmpPath))
 
    '## replace underscores with spaces and upshift the following character
    for each letter in letters
        strTmpPath = Replace(Trim(strTmpPath),"_" & lcase(letter)," " & UCase(letter))
    next
 
    '## split the next one out    <----------------------
    FullPath = mid(FullPath,instr(1,FullPath,"/")+1,Len(FullPath)-Len(tmpPath))
 
    '## separate them with >> symbols
    IF strTmpPath = "" THEN
        response.write "<a href=""/"" style=""text-decoration:none"">Home Page</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 " : Current Page"
ELSE
    response.write " : " & PageTitle
END IF
 
End Function %>
It replaces the first underscore with a space, and capitalises all words but doesn't replace a second underscore, for example in "facts-and-figures", one gets "Facts And_Figures".

I think the error is just after the comment marked with <--------, but my brain is mush today and I can't see why. All assistance gratefully received.
LoisWakeman is offline   Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compuserve Classic ISP going bye-bye... terrie The Corner Pub 88 05-22-2009 03:14 PM
Hex code for silver dacoyle Print Design 8 10-27-2006 08:38 PM
Who owns the code? Linda Baldwin General Publishing Topics 15 03-31-2006 04:06 PM
Valid code, or perhaps not... Bo Aakerstrom Web Site Building & Maintenance 5 03-01-2006 11:43 AM


All times are GMT -8. The time now is 03:22 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Contents copyright 2004–2014 Desktop Publishing Forum and its members.