Foros del Web » Programando para Internet » ASP Clásico »

Obtener el título de alguna páagina

Estas en el tema de Obtener el título de alguna páagina en el foro de ASP Clásico en Foros del Web. Esta función sirve para obtener el texto que se encuentra entre <title> y </title> de cualquier página.... <% Function titulo(de_esta_pagina) Dim objFSO Set objFSO = ...
  #1 (permalink)  
Antiguo 18/02/2002, 18:33
 
Fecha de Ingreso: octubre-2000
Ubicación: Juarez, Chih.
Mensajes: 161
Antigüedad: 23 años, 8 meses
Puntos: 0
Obtener el título de alguna páagina

Esta función sirve para obtener el texto que se encuentra entre <title> y </title> de cualquier página....

<%
Function titulo(de_esta_pagina)

Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObje ct")

Dim objFile
Set objFile = objFSO.OpenTextFile(Server.MapPath(de_esta_pagina) )

Dim strContents
strContents = objFile.ReadAll

objFile.Close
Set objFile = Nothing
Set objFSO = Nothing

Dim objRegExp
Set objRegExp = New RegExp

Dim strHTML, strMatch
strMatch = "<title>(.*?)<\/title>"

objRegExp.Pattern = strMatch
objRegExp.IgnoreCase = True
objRegExp.Global = True

Dim objMatches
Set objMatches = objRegExp.Execute(strContents)

If objMatches.Count > 0 then
titulo = "El titulo de la página..." & de_esta_pagina & " es: " & Mid(objMatches(0).Value, 8, Len(objMatches(0).Value) - 16)
Else
titulo = "No se encontró el título de la página " & de_esta_pagina
End If
Set objRegExp = Nothing

End Function
%>

<%
Response.Write titulo("/algun_directorio/alguna_pagina.html")
%>

---------------------
Tan libre como gratuito!!!
  #2 (permalink)  
Antiguo 19/02/2002, 00:04
Avatar de urjose  
Fecha de Ingreso: diciembre-2001
Mensajes: 5.286
Antigüedad: 22 años, 5 meses
Puntos: 1
Re: Obtener el título de alguna páagina

hi

bueno desde aqui te agradezo los tips que estas mandando, ya me guarde uno que otro, bueno todos... jeje, gracias por compartirlos


saludos :) ;)
  #3 (permalink)  
Antiguo 19/02/2002, 04:12
Avatar de Aston  
Fecha de Ingreso: mayo-2001
Ubicación: Madrid
Mensajes: 933
Antigüedad: 23 años, 1 mes
Puntos: 0
Re: Obtener el título de alguna páagina

¡Genial tip, vGaray! Mis felicitacioens. :)

<a href="http://www.laventanita.net/" target="_blank">
<img src="http://www.breogan.org/images/Aston.gif" border="0" alt="La Ventanita.net - Lo imprescindible en la red"></a>
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 02:06.