G
Guest
Hi there,
I'm using VBScript to display a list of the ten most recently updated
pages on my web site. Right now, the script lists the filenames and
the date modified in a given directory.
What I want to know is if there is any way to extract the page title
and display that instead of the file name? Can I use .asp and VBscript
to "delve" into the file and extract the title?
Here's the code I'm using:
<%
folder = ".\"
set fso = CreateObject("Scripting.fileSystemObject")
set fold = fso.getFolder(Server.MapPath(folder))
fileCount = fold.files.count
dim fNames(), fDates()
redim fNames(fileCount), fDates(fileCount)
cFcount = 0
for each file in fold.files
cFcount = cFcount + 1
fNames(cFcount) = lcase(file.name)
fDates(cFcount) = file.dateLastModified
next
for tName = 1 to fileCount
for nName = (tName + 1) to fileCount
if (fDates(tName) < fDates(nName)) then
buffer = fNames(nName)
dateBuffer = fDates(nName)
fNames(nName) = fNames(tName)
fDates(nName) = fDates(tName)
fNames(tName) = buffer
fDates(tName) = dateBuffer
end if
next
next
if (fileCount > 10) then
fileCount = 10
End If
Response.Write "<table border=1 width='90%'>"
for i = 1 to fileCount
Response.Write "<tr><td><a href='" & fNames(i) & "'>" &
fNames(i) & "</a></td><td>" & fDates(i) & "</td></tr>"
next
Response.Write "</table>"
%>
I'm using VBScript to display a list of the ten most recently updated
pages on my web site. Right now, the script lists the filenames and
the date modified in a given directory.
What I want to know is if there is any way to extract the page title
and display that instead of the file name? Can I use .asp and VBscript
to "delve" into the file and extract the title?
Here's the code I'm using:
<%
folder = ".\"
set fso = CreateObject("Scripting.fileSystemObject")
set fold = fso.getFolder(Server.MapPath(folder))
fileCount = fold.files.count
dim fNames(), fDates()
redim fNames(fileCount), fDates(fileCount)
cFcount = 0
for each file in fold.files
cFcount = cFcount + 1
fNames(cFcount) = lcase(file.name)
fDates(cFcount) = file.dateLastModified
next
for tName = 1 to fileCount
for nName = (tName + 1) to fileCount
if (fDates(tName) < fDates(nName)) then
buffer = fNames(nName)
dateBuffer = fDates(nName)
fNames(nName) = fNames(tName)
fDates(nName) = fDates(tName)
fNames(tName) = buffer
fDates(tName) = dateBuffer
end if
next
next
if (fileCount > 10) then
fileCount = 10
End If
Response.Write "<table border=1 width='90%'>"
for i = 1 to fileCount
Response.Write "<tr><td><a href='" & fNames(i) & "'>" &
fNames(i) & "</a></td><td>" & fDates(i) & "</td></tr>"
next
Response.Write "</table>"
%>