Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

include

Status
Not open for further replies.

help120

Technical User
Apr 15, 2001
198
US
Ok I've 2 pages..
/nps/pic.asp ( )
and
/nps/news/gallery/picturegallery.asp ( )

I'm trying to include the picturegallery.asp into the pic.asp page. I keep getting this error
---------------------------------------------------------
Microsoft VBScript runtime error '800a004c'

Path not found

C:\INETPUB\FINALPHASE\ line 46
---------------------------------------------------------
I've tryed taking the nps dir out of the include code but then I get a dif error.
Here is my html code for pic.asp

<html>

<head>
<meta http-equiv=&quot;Content-Language&quot; content=&quot;en-us&quot;>
<meta name=&quot;GENERATOR&quot; content=&quot;Microsoft FrontPage 5.0&quot;>
<meta name=&quot;ProgId&quot; content=&quot;FrontPage.Editor.Document&quot;>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=windows-1252&quot;>
<title>New Page 1</title>
</head>

<body>
<!-- #INCLUDE FILE= &quot;../nps/inc_top.asp&quot; -->
<div align=&quot;center&quot;>
<center>
<table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;
style=&quot;border-collapse: collapse&quot; bordercolor=&quot;#FFAE00&quot; width=&quot;95%&quot;
id=&quot;AutoNumber1&quot;>
<tr>
<td width=&quot;100%&quot; align=&quot;left&quot; valign=&quot;top&quot; bgcolor=&quot;#AD7500&quot;>
<p align=&quot;center&quot;><font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#FFFFFF&quot;>Never Play Soberz
Picture Gallery</font></td>
</tr>
<tr>
<td width=&quot;100%&quot; align=&quot;left&quot; valign=&quot;top&quot;>
<div align=&quot;center&quot;>
<center>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;4&quot;
style=&quot;border-collapse: collapse&quot; bordercolor=&quot;#111111&quot; width=&quot;100%&quot;
id=&quot;AutoNumber2&quot;>
<tr>
'##################### Code that will not work ##########
<td width=&quot;100%&quot; align=&quot;left&quot; valign=&quot;top&quot;><!-- #INCLUDE FILE= &quot;..\nps\news\gallery\picturegallery.asp&quot; --></td>
</tr>
</table>
</center>
</div>
</td>
</tr>
</table>
</center>
</div>

</body>

</html>
 
What's in the other page??? I need to see you connect line

Have Fun...

Sharky99 >:):O>
 
<!--#include file=&quot;config.asp&quot;--><%
'*********************************************************************************
' Picture Gallery ASP script(c) Fedor Skvortsov, COMobjects.NET. June, 2001
' Mailto: support@comobjects.net
' WWW: '*********************************************************************************

'If number of pictures exceedes intMaxPictures, contents of the folder
'splits into pages.
Dim intMaxPictures
intMaxPictures = intColCount * intMaxRows

'Getting parameters from URL.

Dim strPath, intPage, strPhysicalPath, strPicture

'Path to the current folder of the gallery
strPath = Request.QueryString(&quot;path&quot;)

'Number of the current page. Default value is 1
If Request.QueryString(&quot;page&quot;)<>&quot;&quot; Then
intPage = CInt(Request.QueryString(&quot;page&quot;))
Else
intPage=1
End If

'Filename of the picture
strPicture = Request.QueryString(&quot;picture&quot;)

'Physical path of the current folder
strPhysicalPath = Server.MapPath(strGalleryPath & strPath)

'Prevent somebody from browsing the structure of file system
'*******************************************************************************************************
If InStr(1, Server.MapPath(strGalleryPath & strPath), Server.MapPath(strGalleryPath), 1) <> 1 Or _
InStr(1,Server.MapPath(strGalleryPath & strPath & strPicture), Server.MapPath(strGalleryPath), 1) <> 1 Then
Err.Raise 5054, &quot;COMobjectsNET PictureGallery Script&quot;, &quot;Security Error&quot;
End If
'*******************************************************************************************************

Dim objFileSystem, objFolder, objSubFolder, objFile
Set objFileSystem = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set objFolder = objFileSystem.GetFolder(strPhysicalPath)

'Displaying Path to the current folder (or picture) and placing references to the folders
Dim strFolders
strFolders = Split(strPath, &quot;/&quot;)

Response.Write &quot;<table width='&quot; & strGalleryWidth & &quot;'><tr><td width='100%'><p class=path><img border='0' src='&quot; & strOpenFolderIcon & &quot;'>&quot;
If strPath<>&quot;&quot; Or strPicture<>&quot;&quot; Then
Response.Write &quot; <a href='PictureGallery.asp'>Gallery</a>&quot;
Else
Response.Write &quot; Gallery&quot;
End If
Dim strP
strP = &quot;&quot;
For I=0 To UBound(strFolders)-2
strP= strP + strFolders(i) + &quot;/&quot;
Response.Write &quot;\<a href='PictureGallery.asp?path=&quot; & Server.URLEncode(strP) & &quot;'>&quot; & strFolders(i) & &quot;</a>&quot;
Next
If UBound(strFolders)>0 Then
If strPicture=&quot;&quot; Then
Response.Write &quot;\&quot; & strFolders(UBound(strFolders)-1)
Else
strP = strP + strFolders(UBound(strFolders)-1) + &quot;/&quot;
Response.Write &quot;\<a href='PictureGallery.asp?path=&quot; & Server.URLEncode(strP) & &quot;&page=&quot; & intPage & &quot;'>&quot;
Response.Write strFolders(UBound(strFolders)-1) & &quot;</a>&quot;
End If
End If
If strPicture<>&quot;&quot; Then
Response.Write &quot;\&quot; & strPicture
End If
Response.Write &quot;</p></td>&quot;

'Displaying &quot;Top&quot; and &quot;Parent&quot; buttons
Response.Write &quot;<td width='100'><p>&quot;
If strPath<>&quot;&quot; Or strPicture<>&quot;&quot; Then
Response.Write &quot;<a href='PictureGallery.asp?path=&quot; & Server.URLEncode(strP)
If strPicture<>&quot;&quot; Then Response.Write &quot;&page=&quot; & intPage
Response.Write &quot;'>&quot;
Response.Write &quot;<img border='0' src='&quot; & strParentButton & &quot;'></a>&quot;
Else
Response.Write &quot;<img border='0' src='&quot; & strParentButtonDisabled & &quot;'>&quot;
End If
Response.Write &quot;</p></td><td width='100'><p>&quot;
If strPath<>&quot;&quot; Or strPicture<>&quot;&quot; Then
Response.Write &quot;<a href='PictureGallery.asp'><img border='0' src='&quot; & strTopButton & &quot;'></a>&quot;
Else
Response.Write &quot;<img border='0' src='&quot; & strTopButtonDisabled & &quot;'>&quot;
End If
Response.Write &quot;</p></td></tr></table><br>&quot;

'Creating description file if it is missed and auto generation of it is enabled
Dim strDescFilePath, objDescFile
strDescFilePath = objFolder.Path + &quot;\&quot; + strDescFileName
If blnDescCreation Then
If Not objFileSystem.FileExists(strDescFilePath) Then
Set objDescFile = objFileSystem.CreateTextFile(strDescFilePath)
objDescFile.WriteLine &quot;FileName&quot; & strDelimiter & &quot;Description&quot;
objDescFile.Close
Set objDescFile = Nothing
End If
End If
'Opening description file with ADO
'Determines exists or not description file.
'If description file exists it equals 1, elsewhere 0.
Dim intDescExists
Dim objConnection, objRecordSet, strConnString
Set objRecordSet = Server.CreateObject(&quot;ADODB.RecordSet&quot;)
If objFileSystem.FileExists(strDescFilePath) Then
strConnString = &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot; & objFolder.Path & &quot;;Extended Properties='text;FMT=Delimited'&quot;
Set objConnection = Server.CreateObject(&quot;ADODB.Connection&quot;)
objConnection.ConnectionTimeout = 15
objConnection.Open strConnString
intDescExists = 1
Else
intDescExists = 0
objConnection = null
End If
'Displaying subfolders and thumbnails or whole picture
If strPicture=&quot;&quot; Then
'Displaying subfolders
Response.Write &quot;<table width='&quot; & strGalleryWidth & &quot;'>&quot;
Dim I
I= 0
For Each objSubFolder In objFolder.SubFolders
'Don't display thumbnails and hidden folders, such as Front Page Extensions ones
If Left(objSubFolder.Name,1)<>&quot;_&quot; And objSubFolder.Name<>&quot;Thumbnails&quot; Then
If I Mod 2 = 0 Then Response.Write &quot;<tr>&quot;
Response.Write &quot;<td width='50%'>&quot;
Response.Write &quot;<p class=folder><img border='0' src='&quot; & strFolderIcon & &quot;'>  &quot;
Response.Write &quot;<a target='_self' href='PictureGallery.asp?path=&quot; & Server.URLEncode(strPath & objSubFolder.Name) & &quot;/'>&quot;
Response.Write objSubFolder.Name
Response.Write &quot;</a> (&quot;
If objFileSystem.FileExists(objSubFolder.Path & &quot;\&quot; & strDescFileName) Then
Response.Write objSubFolder.Files.Count - 1
Else
Response.Write objSubFolder.Files.Count
End If
Response.Write &quot;)</p></td>&quot;
If I Mod 2 = 1 Then Response.Write &quot;</tr>&quot;
I=I+1
End If
Next
If I Mod 2 = 1 Then Response.Write &quot;<td></td></tr>&quot;
Response.Write &quot;</table>&quot;

'Displaying thumbnails
Response.Write &quot;<table width='&quot; & strGalleryWidth & &quot;'>&quot;
I = 0
For Each objFile In objFolder.Files
If objFile.Name<>strDescFileName Then
If (I+1)>=((intPage-1)*intMaxPictures+1) And (I+1)<=((intPage)*intMaxPictures) Then
If I Mod intColCount = 0 Then Response.Write &quot;<tr>&quot;
Response.Write &quot;<td width='&quot; & 100 \ intColCount & &quot;%' align='center' valign='top'>&quot;
Response.Write &quot;<table width='100%'>&quot;
Response.Write &quot;<tr><td width='100%' height='&quot; & (intThumbnailSize + 5) & &quot;' valign='bottom' align='center'>&quot;
Response.Write &quot;<a target='_blank' href='PictureGallery.asp?path=&quot; & Server.URLEncode(strPath)
Response.Write &quot;&picture=&quot; & Server.URLEncode(objFile.Name) & &quot;&page=&quot; & intPage & &quot;'>&quot;
Response.Write &quot;<img border='0' class=thumb src='thumbnail.asp?path=&quot;
Response.Write Server.URLEncode(strGalleryPath & strPath & objFile.Name) & &quot;&size=&quot; & intThumbnailSize & &quot;'>&quot;
Response.Write &quot;</a></td></tr>&quot;
'Displaying picture info
Response.Write &quot;<tr><td align='center' height='50' width='100%' class='infobox'>&quot;
Response.Write &quot;<p>&quot;
If intDescExists=1 Then
objRecordSet.Open &quot;Select * From &quot; & strDescFileName & &quot; Where FileName='&quot; & objFile.Name & &quot;'&quot;, objConnection, 3, 1, 1
If Not objRecordSet.EOF Then
If objRecordSet(1)<>&quot;&quot; Then
Response.Write &quot;<span class=description>&quot; & objRecordSet(1) & &quot;</span><br>&quot;
End If
Else
If blnDescCreation Then
objConnection.Execute &quot;INSERT INTO &quot; & strDescFileName & &quot;(FileName, Description) VALUES('&quot; & objFile.Name & &quot;', '')&quot;
End If
End If
objRecordSet.Close
End If
Response.Write &quot;<span class=info>&quot; & objFile.Name & &quot;</span><br>&quot;
Response.Write &quot;<span class=info>&quot; & Month(objFile.DateLastModified) & &quot;/&quot;
Response.Write Day(objFile.DateLastModified) & &quot;/&quot; & Year(objFile.DateLastModified) & &quot;</span><br>&quot;
Response.Write &quot;<span class=info>&quot; & objFile.Size \ 1024 & &quot;kb</span>&quot;
Response.Write &quot;</p></td></tr></table></td>&quot;
If I Mod intColCount = intColCount-1 Then Response.Write &quot;</tr>&quot;
End If
I=I+1
End If
Next

If I Mod intColCount > 0 Then
Dim J
For J=(I Mod intColCount) + 1 To intColCount
Response.Write &quot;<td width='&quot; & 100 \ intColCount & &quot;%' align='center' valign='bottom'>&quot;
Response.Write &quot;<table width='100%'>&quot;
Response.Write &quot;<tr></tr></table></td>&quot;
Next
Response.Write &quot;</tr>&quot;
End If
Response.Write &quot;</table>&quot;

'Diplaying references to the pages if it's necessary
If objFolder.Files.Count-intDescExists>intMaxPictures Then
Dim intTotalPages
intTotalPages = (objFolder.Files.Count + intMaxPictures - 1 - intDescExists) \ intMaxPictures
Response.Write &quot;<table width='&quot; & strGalleryWidth & &quot;'><tr>&quot;
Response.Write &quot;<td width='100%' align='center'><p class=navbar>&quot;
If intPage>1 Then
Response.Write &quot;<a href='PictureGallery.asp?path=&quot; & Server.URLEncode(strPath) & &quot;&page=&quot; & intPage-1 & &quot;'><< Prev <<</a>&quot;
Else
Response.Write &quot;<< Prev <<&quot;
End If
For I=1 To intTotalPages
If I<>intPage Then
Response.Write &quot;<a href='PictureGallery.asp?path=&quot; & Server.URLEncode(strPath) & &quot;&page=&quot; & I & &quot;'>| &quot; & (I-1)*intMaxPictures+1 & &quot;-&quot;
If I*intMaxPictures>objFolder.Files.Count-intDescExists Then
Response.Write objFolder.Files.Count-intDescExists
Else
Response.Write I*intMaxPictures
End If
Response.Write &quot; |</a>&quot;
Else
Response.Write &quot;| &quot; & (I-1)*intMaxPictures+1 & &quot;-&quot;
If I*intMaxPictures>objFolder.Files.Count-intDescExists Then
Response.Write objFolder.Files.Count-intDescExists
Else
Response.Write I*intMaxPictures
End If
Response.Write &quot;|&quot;
End If
Next
If intPage<intTotalPages Then
Response.Write &quot;<a href='PictureGallery.asp?path=&quot; & Server.URLEncode(strPath) & &quot;&page=&quot; & intPage+1 & &quot;'>>> Next >></a>&quot;
Else
Response.Write &quot;>> Next >>&quot;
End If
Response.Write &quot;</p></td></tr></table>&quot;
End If

Else
'Displaying whole picture
Response.Write &quot;<table width='&quot; & strGalleryWidth & &quot;'>&quot;
Response.Write &quot;<tr><td width='100%' align='center'>&quot;

On Error Resume Next
If intDescExists=1 Then
objRecordSet.Open &quot;Select * From &quot; & strDescFileName & &quot; Where FileName='&quot; & strPicture & &quot;'&quot;, objConnection, 3, 1, 1
If Not objRecordSet.EOF Then
If objRecordSet(1)<>&quot;&quot; Then
Response.Write &quot;<p class=description>&quot; & objRecordSet(1) & &quot;</p>&quot;
End If
End If
objRecordSet.Close
End If
On Error GoTo 0

Response.Write &quot;<img class=fullimage src='&quot; & strGalleryPath & strPath & strPicture & &quot;'>&quot;

'Scanning for files in folder
Dim strFiles()
ReDim strFiles(objFolder.Files.Count-intDescExists)
I = 0
Dim intPicture
For Each objFile in objFolder.Files
If objFile.Name<>strDescFileName Then
strFiles(I) = objFile.Name
If objFile.Name = strPicture Then intPicture = I
I = I + 1
End If
Next
Response.Write &quot;<p align=center class=navbar>&quot;
If intPicture>0 Then
Response.Write &quot;<a href='PictureGallery.asp?path=&quot; & Server.URLEncode(strPath)
Response.Write&quot;&picture=&quot; & Server.URLEncode(strFiles(intPicture-1)) & &quot;'><< Prev <<</a> &quot;
Else
Response.Write &quot;<< Prev << &quot;
End If

For I=0 To UBound(strFiles)-1
If I<>intPicture Then
Response.Write &quot;<a href='PictureGallery.asp?path=&quot; & Server.URLEncode(strPath)
Response.Write&quot;&picture=&quot; & Server.URLEncode(strFiles(I)) & &quot;'>| &quot; & I+1 & &quot; |</a> &quot;
Else
Response.Write &quot;| &quot; & (I+1)
Response.Write &quot;| &quot;
End If
Next
If intPicture+1<UBound(strFiles) Then
Response.Write &quot; <a href='PictureGallery.asp?path=&quot; & Server.URLEncode(strPath)
Response.Write&quot;&picture=&quot; & Server.URLEncode(strFiles(intPicture+1)) & &quot;'>>> Next >></a>&quot;
Else
Response.Write &quot; >> Next >>&quot;
End If
Response.Write &quot;</p></td></tr></table>&quot;
End If
If objConnection<>Null Then objConnection.Close
Set objConnection = Nothing
Set objRecordSet = Nothing
Set objFolder = Nothing
Set objFileSystem = Nothing
%>
 
I'm not really an asp pro but i'll try to help


First you should always use:

<%@ Language=VBScript %>
<% Option Explicit %>
<%
dim OyDate, blabla....

at the beginning of your asp pages.

The error indicates some wrong in your path

NPS\..\nps\news\gallery\picturegallery.asp

Try using only one &quot;.&quot; in your string, with two you come back to the previous dir

It should look like this

.\nps\news\gallery\picturegallery.asp

maybe even better with the full path???


Have Fun...

Sharky99 >:):O>


 
you can't use the full path.. at least I don't think you can.
 
When ever you include a file using the &quot;file&quot; include, it'll be relative to the folder that page is in. If you use the &quot;virtual&quot;, it'll always be from the host dns name.

Example:
You have a file located at c:\inetpub\wwwroot\include\myFile.asp that you want to include in other pages throughout your web site...

Page: 1.asp
Location: C:\inetpub\-------------------------------------
<!-- #include file=&quot;myfile.asp&quot;-->
<html>
<head>
....etc, etc, etc

That will have an error because it's telling it to include a file located at c:\inetpub\wwwroot\private\myFile.asp when the file actually lies in a same level folder called &quot;include&quot;. So you would have to edit the include statement to read...
<!-- #include file=&quot;../include/myFile.asp&quot; --> to pull the file corrrectly.

This is somtimes good, but in many cases, you want to have the same path written on all your pages for the include statment, so it's more logical to use a virtual path include.

<!-- #include virtual=&quot;include/myFile.asp&quot; -->

This tells it to pull from your main folder located at c:\inetpub\wwwroot where your domain name is pointed to ( then go to the include folder within that folder, and within that is a file named &quot;myFile.asp&quot; that it wants to include.

Hope that makes sense.
-Ovatvvon :-Q
 
umm.. to tired will look at it in the morning.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top