<%@LANGUAGE="VBSCRIPT"%> <% dim Conn, strSql, rs, strMessage set Conn = server.createobject("ADODB.Connection") Conn.open strConn %> Newstoday
 
<% set rsnews = server.createobject("ADODB.Recordset") strSql = "select top 10 * from tblNews where thedate >= date() order by theDate" rsnews.open strSql, Conn do while not rsnews.eof %>
" target="_parent"><%= rsnews("Headline")%>

<%= Excerpt(rsnews("thetext"),40,60)%>
 
<% rsnews.movenext loop rsnews.close : set rsnews = nothing Conn.close : set Conn = nothing %> <% Function Excerpt(inputString, minLength, maxLength) If inputString <> "" Then Dim theString, a, b, i, outputLimit, PunctuationString theString = Trim(inputString) Do a = InStr(a + 1, theString, "<") If a > 0 Then b = InStr(a, theString, ">") If b > 0 Then theString = Trim(Left(theString, a - 1)) & " " & Trim(Mid(theString, b + 1)) Else exitLoop = True End If a = 0 Else exitLoop = True End If 'CheckConnection Loop Until exitLoop = True PunctuationString = ".!?:;," outputLimit = maxLength For i = 1 To Len(PunctuationString) a = InStr(minLength, theString, Mid(PunctuationString, i, 1) & " ") If a > 0 And a < outputLimit Then outputLimit = a Next outputString = Left(theString, outputLimit) If Len(RTrim(theString)) > Len(RTrim(outputString)) Then outputString = RTrim(outputString) & ".." Excerpt = outputString End If End Function %>