ReadHTMLTag

Reads string between open and close HTML tag (between < ... > and < / ... >), pass the file name, and the tag (without < or This was originally a function called Title that reads the title of an HTML page


Public

Not Tested

Not My Work
<%
Function ReadHTMLTag(HTMLBlock, BetweenTag)
    Tag1 = "<" & UCase(BetweenTag)
    Tag2 = ""
    firstCt = InStr(1, UCase(HTMLBlock), Tag1) + Len(Tag1)
    firstCt = InStr(firstCt, UCase(HTMLBlock), ">") + 1
    secondCt = InStr(UCase(HTMLBlock), Tag2)
    tmp = Mid(HTMLBlock, firstCt, secondCt - firstCt)
    ReadHTMLTag = CStr(Trim(tmp))
End Function


' ======================= Original function
' Example of calling Original function
' Title(server.mappath("/file.htm"))

' Original function was Title
Private Function Title(byVal pathname)
    dim objFSO, objFile, a, tmp, firstCt, secondCt
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile(pathname, 1, False)
    a = objFile.ReadAll()
    objFile.Close
    Set objFile = Nothing
    Set objFSO = Nothing
    firstCt = InStr(UCASE(a), "") + 7<br/>    secondCt = InStr(UCASE(a), "")
    tmp = Mid( a, firstCt, secondCt - firstCt )
    Title = CStr( Trim( tmp ) )
End Function
%>

pathname, BetweenTag

<% = ReadHTMLTag(FullHTMLBlock, "Title") %>

Views 921 Downloads 308

Classic ASP Texts + Strings
ANmarAmdeen
813
Attachments
Revisions

v6.0

Needs