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

FileSystemObject_Paginación

Estas en el tema de FileSystemObject_Paginación en el foro de ASP Clásico en Foros del Web. Estimados amigos: ¿Alguien dispone de un código de páginación [10 en 10] para el siguiente FileSystemObject? Gracias, Emajesus <%@ Language=VBScript %> <html> <head> </HEAD> <BODY> ...
  #1 (permalink)  
Antiguo 19/05/2003, 14:36
Avatar de emajesus  
Fecha de Ingreso: abril-2003
Mensajes: 278
Antigüedad: 21 años, 1 mes
Puntos: 1
FileSystemObject_Paginación

Estimados amigos:

¿Alguien dispone de un código de páginación [10 en 10] para el siguiente FileSystemObject?

Gracias,

Emajesus


<%@ Language=VBScript %>
<html>
<head>
</HEAD>
<BODY>

<%
dim strPathInfo, strPhysicalPath
strPathInfo = Request.ServerVariables("PATH_INFO")
strPhysicalPath = Server.MapPath(strPathInfo)

Dim objFSO, objFile, objFileItem, objFolder, objFolderContents
Set objFSO = createObject("scripting.FileSystemObject")

Set objFile = objFSO.GetFile(strPhysicalPath)

Set objFolder = objFile.ParentFolder

Set objFolderContents = objFolder.Files
%>
<div align="center">
<center>
<table cellpadding=5 style="border-collapse: collapse" bordercolor="#111111" cellspacing="0" border="1">
<tr align=center><th align=left><font face="Verdana" size="2">File Name</font></th><th>
<font face="Verdana" size="2">Type</font></th><th>
<font face="Verdana" size="2">File Size</font></th><th>
<font face="Verdana" size="2">Last Modified</font></th></tr>
<%
For each objFileItem in objFolderContents
%>
<tr><td align=left>
<font face="verdana" size="2" color="darkgreen">
<a href="<%= objFileItem.Name %>"><%= objFileItem.Name %></a></font>&nbsp;</td>
<td align=right><font face="verdana" size="2" color="darkgreen"><%= objFileItem.Type %></font>&nbsp;</td>
<td align=right><font face="verdana" size="2" color="darkgreen"><%= objFileItem.Size %></font>&nbsp;</td>
<td align=right><font face="verdana" size="2" color="darkgreen"><%= objFileItem.DateLastModified %></font>&nbsp;</td>
</tr>
<%
Next
%>
</TABLE>
</center>
</div>
</BODY>
</HTML>

Al menos decidme si es posible ;)

Un saludo,

Emajesus

EUREKA : YO ME LO GUISO YO ME LO COMO

<html>
<head>
<title>Spoof Ads</title>
</head>
<body>
<%


strPhysicalPath = "/spoofs/" ' Mappen med filerne
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFS.GetFolder(Server.MapPath(strPhysicalPath))
Set objFiles = objFolder.Files


intPage = Request.Querystring("page")
If isNumeric(intPage) = False Or intPage < 1 Then
intPage = 1
End If

intPageSize = 10 ' Antal filer på hver side
intImgCount = objFiles.Count
intPageCount = -Int(-(objFiles.Count/intPageSize))

Response.Write "<p><strong>" & objFiles.Count & " Imágenes - "
Response.Write "página " & intPage & " de " & intPageCount & ":</strong></p>"

For Each objFileItem In objFiles
intFile = intFile +1
If (intFile >= ((intPage-1)*intPageSize)+1) And (intFile =< (intPageSize*intPage)) Then
Response.Write "<p><a href='" & strPhysicalPath & objFileItem.Name & "'>" & strPhysicalPath &

objFileItem.Name & "</a></p>"
End If
Next

strScriptName = Request.Servervariables("ScriptName")
Response.Write "<p>Páginas: "
For i = 1 To intPageCount
Response.Write "<a href=" & strScriptName & "?page=" & i & ">" & i & "</a> "
Next
Response.Write "</p>"
Set objFS = Nothing
%>
</body>
</html>

Última edición por emajesus; 19/05/2003 a las 14:36
  #2 (permalink)  
Antiguo 20/05/2003, 02:00
Avatar de Helbira  
Fecha de Ingreso: octubre-2001
Ubicación: Sevilla, España
Mensajes: 1.228
Antigüedad: 22 años, 7 meses
Puntos: 5
Añado link donde se explica como paginar una página en ASP:

Paginación en ASP

Un beso

P.D.: Viva er Betis manque pierda !
  #3 (permalink)  
Antiguo 20/05/2003, 11:34
Avatar de emajesus  
Fecha de Ingreso: abril-2003
Mensajes: 278
Antigüedad: 21 años, 1 mes
Puntos: 1
Amigos,

Al código anterior qué debo añadirle para que me destaque en un tamaño mayor el número de la página en que me encuentro; por ejemplo, con un size=2.

Gracias,

Emajesus
  #4 (permalink)  
Antiguo 20/05/2003, 11:43
Avatar de Helbira  
Fecha de Ingreso: octubre-2001
Ubicación: Sevilla, España
Mensajes: 1.228
Antigüedad: 22 años, 7 meses
Puntos: 5
<html>
<head>
<title>Spoof Ads</title>
</head>
<body>
<%


strPhysicalPath = "/spoofs/" ' Mappen med filerne
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFS.GetFolder(Server.MapPath(strPhysicalPath))
Set objFiles = objFolder.Files


intPage = Request.Querystring("page")
If isNumeric(intPage) = False Or intPage < 1 Then
intPage = 1
End If

intPageSize = 10 ' Antal filer på hver side
intImgCount = objFiles.Count
intPageCount = -Int(-(objFiles.Count/intPageSize))

Response.Write "<p><strong>" & objFiles.Count & " Imágenes - "
Response.Write "página <font size=2> " & intPage & " </font> de " & intPageCount & ":</strong></p>"

For Each objFileItem In objFiles
intFile = intFile +1
If (intFile >= ((intPage-1)*intPageSize)+1) And (intFile =< (intPageSize*intPage)) Then
Response.Write "<p><a href='" & strPhysicalPath & objFileItem.Name & "'>" & strPhysicalPath &

objFileItem.Name & "</a></p>"
End If
Next

strScriptName = Request.Servervariables("ScriptName")
Response.Write "<p>Páginas: "
For i = 1 To intPageCount
Response.Write "<a href=" & strScriptName & "?page=" & i & ">" & i & "</a> "
Next
Response.Write "</p>"
Set objFS = Nothing
%>
</body>
</html>
  #5 (permalink)  
Antiguo 20/05/2003, 13:09
Avatar de emajesus  
Fecha de Ingreso: abril-2003
Mensajes: 278
Antigüedad: 21 años, 1 mes
Puntos: 1
Me refería a destacar el número de página de la sucesión que aparece abajo; es decir, ... 1 2 3 4 5 6 ...

Si estoy en la página 2 que se resalte el 2 ...

Un saludo y gracias,

Emajesus
  #6 (permalink)  
Antiguo 21/05/2003, 01:21
Avatar de Helbira  
Fecha de Ingreso: octubre-2001
Ubicación: Sevilla, España
Mensajes: 1.228
Antigüedad: 22 años, 7 meses
Puntos: 5
<html>
<head>
<title>Spoof Ads</title>
</head>
<body>
<%


strPhysicalPath = "/spoofs/" ' Mappen med filerne
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFS.GetFolder(Server.MapPath(strPhysicalPath))
Set objFiles = objFolder.Files


intPage = Request.Querystring("page")
If isNumeric(intPage) = False Or intPage < 1 Then
intPage = 1
End If

intPageSize = 10 ' Antal filer på hver side
intImgCount = objFiles.Count
intPageCount = -Int(-(objFiles.Count/intPageSize))

Response.Write "<p><strong>" & objFiles.Count & " Imágenes - "
Response.Write "página " & intPage & " de " & intPageCount & ":</strong></p>"

For Each objFileItem In objFiles
intFile = intFile +1
If (intFile >= ((intPage-1)*intPageSize)+1) And (intFile =< (intPageSize*intPage)) Then
Response.Write "<p><a href='" & strPhysicalPath & objFileItem.Name & "'>" & strPhysicalPath &

objFileItem.Name & "</a></p>"
End If
Next

strScriptName = Request.Servervariables("ScriptName")
Response.Write "<p>Páginas: "
For i = 1 To intPageCount
Response.Write "<a href=" & strScriptName & "?page=" & i & ">"
IF intPage = i THEN
Response.Write "<font size=2>" & i & "</font>"
ELSE
Response.Write i
END IF

Response.Write "</a> "
Next
Response.Write "</p>"
Set objFS = Nothing
%>
</body>
</html>

Un beso
  #7 (permalink)  
Antiguo 21/05/2003, 02:41
Avatar de emajesus  
Fecha de Ingreso: abril-2003
Mensajes: 278
Antigüedad: 21 años, 1 mes
Puntos: 1
Gracias por tu ayuda.

No obstante, debo comentarte que veo un problemilla. Me cambia el tamaño de letra pero sólo en la primera página; una vez que clico en página 2 -por ejemplo-, todos los números vuelven a tener el mismo tamaño.

¿Qué puede suceder?

De nuevo te reitero mi agradecimiento,

Emajesus
  #8 (permalink)  
Antiguo 21/05/2003, 02:47
Avatar de Helbira  
Fecha de Ingreso: octubre-2001
Ubicación: Sevilla, España
Mensajes: 1.228
Antigüedad: 22 años, 7 meses
Puntos: 5
Puedes poner un enlace para verlo?
  #9 (permalink)  
Antiguo 21/05/2003, 02:52
Avatar de emajesus  
Fecha de Ingreso: abril-2003
Mensajes: 278
Antigüedad: 21 años, 1 mes
Puntos: 1
Aquí lo encuentras.


http://www.canalpublicidad.com/pruebas.asp


Gracias,

Emajesus
  #10 (permalink)  
Antiguo 21/05/2003, 03:25
Avatar de Helbira  
Fecha de Ingreso: octubre-2001
Ubicación: Sevilla, España
Mensajes: 1.228
Antigüedad: 22 años, 7 meses
Puntos: 5
<html>
<head>
<title>Spoof Ads</title>
</head>
<body>
<%


strPhysicalPath = "/spoofs/" ' Mappen med filerne
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFS.GetFolder(Server.MapPath(strPhysicalPath))
Set objFiles = objFolder.Files


intPage = Request.Querystring("page")
If isNumeric(intPage) = False Or intPage < 1 Then
intPage = 1
End If

intPageSize = 10 ' Antal filer på hver side
intImgCount = objFiles.Count
intPageCount = -Int(-(objFiles.Count/intPageSize))

Response.Write "<p><strong>" & objFiles.Count & " Imágenes - "
Response.Write "página " & intPage & " de " & intPageCount & ":</strong></p>"

For Each objFileItem In objFiles
intFile = intFile +1
If (intFile >= ((intPage-1)*intPageSize)+1) And (intFile =< (intPageSize*intPage)) Then
Response.Write "<p><a href='" & strPhysicalPath & objFileItem.Name & "'>" & strPhysicalPath &

objFileItem.Name & "</a></p>"
End If
Next

strScriptName = Request.Servervariables("ScriptName")
Response.Write "<p>Páginas: "
For i = 1 To intPageCount
Response.Write "<a href=" & strScriptName & "?page=" & i & ">"
IF i = CInt(intPage) THEN
Response.Write "<font size=2>" & i & "</font>"
ELSE
Response.Write i
END IF
Response.Write "</a> "
Next
Response.Write "</p>"
Set objFS = Nothing
%>
</body>
</html>
  #11 (permalink)  
Antiguo 21/05/2003, 12:17
Avatar de emajesus  
Fecha de Ingreso: abril-2003
Mensajes: 278
Antigüedad: 21 años, 1 mes
Puntos: 1
Muchísimas gracias; me ha venido de maravillas y funciona genial.

Besos a granel,

Emajesus

Una última cosa y sé que estoy abusando.

¿Cómo se podría paginar y en lugar de numéricamente por letras -es decir, A B C D ...-?

Gracias,

Emajesus

Última edición por emajesus; 21/05/2003 a las 12:17
  #12 (permalink)  
Antiguo 22/05/2003, 01:45
Avatar de Helbira  
Fecha de Ingreso: octubre-2001
Ubicación: Sevilla, España
Mensajes: 1.228
Antigüedad: 22 años, 7 meses
Puntos: 5
Pero para paginar alfabéticamente cambiaría tu código completo ya que harías búsquedas por la inicial seleccionada.

Te dejo el html básico para imprimir el abecedario sensible. Para probarlo sólo tienes que guardar el siguiente código en un archivo que se llame abecedario.asp:

Cita:
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<%
intPage=Request.QueryString("page")
if intPage="" then
intPage=65
end if
For i = 65 To 90
'Response.Write "<a href=" & strScriptName & "?page=" & i & ">"
Response.Write "<a href=abecedario.asp?page=" & i & ">"
IF i = CInt(intPage) THEN
Response.Write "<font size=+2>" & Chr(i) & "</font>"
ELSE
Response.Write Chr(i)
END IF
Response.Write "</a> "
Next
%>
</body>
</html>
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 01:05.