Ver Mensaje Individual
  #10 (permalink)  
Antiguo 15/09/2007, 02:01
Avatar de engonga
engonga
Usuario no validado
 
Fecha de Ingreso: marzo-2002
Ubicación: Buenos Aires
Mensajes: 1.300
Antigüedad: 23 años, 1 mes
Puntos: 8
Re: paginar imagenes

he estado probando y casi me funciona a la perfeccion

el codigo es el siguiente
Código PHP:
<%
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'
:::   pinto totes les imatges per que es precerreguin   :::
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
dim objFSO, objF,objF2,objF3, objFC, objFC2,objFC3
   dim f1, w, h, c, strType, mostranom
   dim quina_carpeta
   quina_carpeta = request.QueryString("carpeta")
   Set objFSO = CreateObject("Scripting.FileSystemObject")
   Set objF = objFSO.GetFolder(Server.MapPath("imatges/seccions/poble/"))
   Set objF2 = objFSO.GetFolder(Server.MapPath("imatges/seccions/allotjament/"))
   Set objF3 = objFSO.GetFolder(Server.MapPath("imatges/seccions/masia/"))
   Set objFC = objF.Files
   Set objFC2 = objF2.Files
   Set objFC3 = objF3.Files
 
dim num_imatges 
num_imatges = 0
sub poble()
   For Each f1 in objFC
   if instr(ucase(f1.Name), ".JPG") or instr(ucase(f1.Name), ".GIF") or instr(ucase(f1.Name), ".PNG")then
   num_imatges = num_imatges + 1
 
     end if
   Next
end sub
crido la funcion poble()
poble
' ara monto el vector
redim foto_imatge(num_imatges)
dim i
i = 0
sub imatges()
   For Each f1 in objFC
   if instr(ucase(f1.Name), ".JPG") or instr(ucase(f1.Name), ".GIF") or instr(ucase(f1.Name), ".PNG")then
   foto_imatge(i) = "imatges/seccions/poble/"&f1.Name
   response.Write "numero array" & i &" imatge: " & foto_imatge(i) &"<br />"
  i = i +1
  
     end if
   Next
end sub

pag = request.querystring("pag")
sub pagina()

if((pag = "") or (pag = 1)) then
         '
en la pagina 1 ves de la imagen 1 a la 10 
         inf 
0
         sup 
=7
else
         
'en otra pagina por ejemplo 2 ves de la imagen 10 (inf) a la 20 (sup)
         '
en la pagina 3 ves de la imagen 20 (infa la 30 (supy así
         inf 
= ((pag*8) - 8)
         
sup inf 7
      end 
if
'muestras los elementos del arreglo imagenes que esten entre inf y sup
for i=inf to sup step 1
%>
esta es la imagen <%=foto_imatge(i)%><br/>
 <% 
next 
end sub
 
'
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
':::   fi  pintar imatges                                :::
'
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%>
<
body>
numero de imagenes total:<br />
<%=
num_imatges%><br /><br />
listado de imagenes <br />
<%
imatges%><br /><br /><br /><br />
<%
pagina%> 
Lo que me pasa que en la carpeta poble tengo 20 imagenes y cuando voy a ?pag=3 me da el error

0x800A0009)
El subíndice está fuera del intervalo: '21'
/vectors.asp, línea 78


y no se como solucionarlo