Ver Mensaje Individual
  #2 (permalink)  
Antiguo 24/05/2006, 05:09
tammander
 
Fecha de Ingreso: enero-2006
Ubicación: Torroles (Costa der Só)
Mensajes: 1.017
Antigüedad: 19 años, 3 meses
Puntos: 7
Leer datos de forma secuencial (linea por linea) es bastante engorroso sobretodo cuantas mas fotos tengas. La idea es la siguiente:

1 - Leer linea a linea hasta algun dato clave que identifique el texto con la foto.
2 - Leer la lina identificada

Si en el archivo de texto los datos los has guardado asi:

[micasa.jpg]Esta es la foto de mi casa
[tucasa.jpg]Esta es la tuya.

etc


Asi lo haria yo:
Código:
<%
Const ForReading = 1
Const Create = False
Dim FSysObj
Dim TS
Dim strLine
Dim strFileName

'Nombre del archivo a buscar
strFoto =  "[" & "micasa.jpg" & "]"

'nombre del fichero a mostrar
strFileName = Server.MapPath("texto.txt")

'Creación del objeto FileSystemObject
Set FSysObj = Server.CreateObject("Scripting.FileSystemObject")

' Abrimos el fichero
Set TS = FSysObj.OpenTextFile(strFileName, ForReading, Create)

If not TS.AtEndOfStream Then
Response.Write "<FONT FACE=Verdana SIZE=1>"
Do While not TS.AtendOfStream
' Leemos el fichero linea a linea y lo mostramos
strLine = TS.ReadLine

if instr(strLine,strFoto) then
        Response.Write i & " " & Server.HTMLEncode(mid(strLine,instr(strLine,strFoto))) & "<br>"
        exit do
end if

loop
End If

' cerramos y destruimos los objetos
TS.Close
Set TS = Nothing
Set FSysObj = Nothing
%>

Esto lo meteria en una funcion y la llamaria por cada foto solicitada.


Un saludo
__________________
"Tus pecados son el estiércol sobre el que florecerán las flores de tus virtudes" - Gerald Messadié -