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 (inf) a la 30 (sup) y 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