Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/07/2008, 07:51
kayserpc
 
Fecha de Ingreso: junio-2008
Mensajes: 6
Antigüedad: 16 años, 11 meses
Puntos: 0
ayuda con funcion cortar links

gentess

estoy intentando hacer una funcion que toma una cadena, y si tiene links los corta, la necesito para una pagina que administro ya que al poner comentarios los usuarios pegan cadenas largas y me desencajan la pagina. El script es el siguiente

************************************************** ***************

<html>
<head>
<title>problema</title>
</head>
<body>
<%
dim strIn, strOut, strTemp, strURL, strClave
dim posIniUrl, posFinUrl, newCad
dim enlaceCorto
posIniUrl = 0
posFinUrl = 0
strTemp = ""
strIN = "Esta es la direccion www.intramed.net pero tenesmos tambien WWW.INTRAMED.NET en nuestra lista, probaremos a continuacion que tambien admita http://www.intramed.net como valido y por ultimo, nos falto probar que HTTP://WWW.INTRAMED.NET tambien cargara"
enlaceCorto = ""
do while (instr(1,strIN,"http.//",1)) or (instr(1,strIN,"www",1))
if instr(strIn,"www") then
strClave ="www"
elseif instr(strIn,"WWW") then
strClave ="WWW"
elseif instr(strIn,"http://") then
strClave ="http://"
else
strClave ="HTTP://"
end if
posIniUrl = instr(strIn,strClave)
strTemp = mid(strIn,1,(posIniUrl)-1)
strOut = mid(strIn,posIniUrl) & " "
posFinUrl = instr(strOut," ")
strURL = mid(strout,1,posFinUrl)
enlaceCorto = (mid(strUrl,1,20) & "...")
if strClave = "www" then
strtemp = strtemp & "<a href= http://" & strUrl & (chr34) & ">" & enlaceCorto & "</a>"
elseif strClave ="WWW" then
strtemp = strtemp & "<a href= http://" & strUrl & (chr34) & ">" & enlaceCorto & "</a>"
else
strtemp = strtemp & "<a href=" & strUrl & (chr34) & ">" & enlaceCorto & "</a>"
end if
strIn = mid(strOut,posfinurl)
newCad = newcad & strTemp
strClave = ""
strTemp = ""
loop
newCad = newcad & strIn
%>
<%
response.write newCad
%>
</body>
</html>
************************************************** ***************


agradeceria mucho me pudieran ayudar