22. januar 2004 - 10:06Der er
4 kommentarer og 1 løsning
billede galleri hvor stien ikke passer
Hej E
Nu har jeg fået lavet et galleri der virker fint,men når jeg prøver at include koderne ind i min default.asp fil (som indeholdder design m.m.) så kan galleri filen der bliver inkluderet ikke finde stien til sig selv (tror jeg).
Hvor dan konmmer jeg uden om dette? Hvordan får jeg koden til at forstå et den er blevet include (lyder underligt :) )
Først den originale kode som virker hvis filen køres autonomt:
<html><head> <title>ASP Picture Album by Jan Borup Coyle</title> <script language="JavaScript"> <!-- function jumppage(sel) { var i = sel.selectedIndex self.location.href = sel.options[i].value } // --> </script> </head><body>
Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.GetFile(strPhysicalPath) Set objFolder = objFile.ParentFolder Set objFolderContents = objFolder.Files For each Folder in objFolder.SubFolders If Left(Folder.Name,1)<>"_" Then Response.write "<option " If ShowSub=Folder.Name Then Response.Write "selected " End if Response.Write"value='" & CurFile & "?ShowSub=" Response.Write(Replace(Folder.Name, " ", "%20")) response.write "'>" Response.Write(Folder.Name & "</option>") If ShowSub <= " " Then ShowSub = Folder.Name End if End if Next Set objFSO = Nothing %> </select></h3> </form> </td> </tr> <tr> <td><%=strPathInfo & "<br>" & strPhysicalPath & "<br>" & ShowSub%></td> <td></td></tr> </table> <hr>
<% If ShowPic > " " then ShowPic = Replace(ShowPic, " ", "%20") Response.Write "<a href='java script:history.go(-1)'><img src='" & ShowPic & "'><BR><BR><B>Go Back</B></a>" Else %> <table border="0" cellpadding="0" cellspacing="5" style="border-collapse: collapse" bordercolor="#111111" width="800" id="AutoNumber1"> <tr> <% strPhysicalPath = Server.MapPath(".\" & ShowSub) If ShowSub > " " then ShowSub = Replace(ShowSub, " ", "%20") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(strPhysicalPath) Set objFolderContents = objFolder.Files For Each objFileItem in objFolderContents If Ucase(Right(objFileItem.Name,4))=".GIF" OR Ucase(Right(objFileItem.Name,4))=".JPG" THEN ShowPic = Replace(objFileItem.Name, " ", "%20") 'Response.write "<td align='center' width='25%'><a href=" & ShowSub & "\" Response.write "<td align='center' width='25%'><a href=" & CurFile & "?ShowPic=" & ShowSub & "\" & ShowPic 'Response.Write(Replace(objFileItem.Name, " ", "%20")) Response.write ">" Response.Write("<img src='" & ShowSub & "\" & objFileItem.Name & "' width=200> ") Response.Write("<p align='center'><b>" & Mid(objFileItem.Name,1,Len(objFileItem.Name)-4) & "</b>") Response.write "</a></td>" PictureNo = PictureNo + 1 If PictureNo=4 Then Response.write "</tr><tr>" PictureNo = 0 End if End if Next Set objFSO = Nothing End if %> </tr> </table> <% End if %> </center> </html>
Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.GetFile(strPhysicalPath) Set objFolder = objFile.ParentFolder Set objFolderContents = objFolder.Files For each Folder in objFolder.SubFolders If Left(Folder.Name,1)<>"_" Then Response.write "<option " If ShowSub=Folder.Name Then Response.Write "selected " End if Response.Write"value='" & CurFile & "?ShowSub=" Response.Write(Replace(Folder.Name, " ", "%20")) response.write "'>" Response.Write(Folder.Name & "</option>") If ShowSub <= " " Then ShowSub = Folder.Name End if End if Next Set objFSO = Nothing %> </select></h3> </form> </td> </tr> <tr> <td><%=strPathInfo & "sad<br>" & strPhysicalPath & "324<br>" & ShowSub%></td> <td></td></tr> </table> <hr>
<% If ShowPic > " " then ShowPic = Replace(ShowPic, " ", "%20") Response.Write "<a href='java script:history.go(-1)'><img src='" & ShowPic & "'><BR><BR><B>Go Back</B></a>" Else %> <table border="0" cellpadding="0" cellspacing="5" style="border-collapse: collapse" bordercolor="#111111" width="800" id="AutoNumber1"> <tr> <% strPhysicalPath = Server.MapPath(".\" & ShowSub) If ShowSub > " " then ShowSub = Replace(ShowSub, " ", "%20") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(strPhysicalPath) Set objFolderContents = objFolder.Files For Each objFileItem in objFolderContents If Ucase(Right(objFileItem.Name,4))=".GIF" OR Ucase(Right(objFileItem.Name,4))=".JPG" THEN ShowPic = Replace(objFileItem.Name, " ", "%20") 'Response.write "<td align='center' width='25%'><a href=" & ShowSub & "\" Response.write "<td align='center' width='25%'><a href=" & CurFile & "?ShowPic=" & ShowSub & "\" & ShowPic 'Response.Write(Replace(objFileItem.Name, " ", "%20")) Response.write ">" Response.Write("<img src='" & ShowSub & "\" & objFileItem.Name & "' width=200> ") Response.Write("<p align='center'><b>" & Mid(objFileItem.Name,1,Len(objFileItem.Name)-4) & "</b>") Response.write "</a></td>" PictureNo = PictureNo + 1 If PictureNo=4 Then Response.write "</tr><tr>" PictureNo = 0 End if End if Next Set objFSO = Nothing End if %> </tr> </table> <% End if %> </center>
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.