Problemer med stier
Jeg har problemer med at få nedenstående script til at virke, så jeg kan ligge html-siderne, som generes på baggrund af temples ned i en underfolder. Jeg vil gerne have en filstruktur, hvor nedenstående fil(build.asp) ligger i øverste niveau, mens de html-generede sider ligger et niveau længere nede. Den fil der hedder template.htm indeholder template, og ligger i en underfolder som hedder template, og der fungerer fint.Håber nogle kan hjælpe - på forhånd tak for hjælpen...
Jeg får fejlen i følgende sektion (hele script længere nede):
'LOOP THROUGH TEMPLATE FILE CONTENT
'------------------------------------
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
BodytextFile = Server.MapPath(strTemplateLocation & "main/template.htm")
' Her kommer fejlen Microsoft VBScript-kørselsfejl error '800a004c' . Path not found /game-research/buildpage.asp, line 67
Set InStream= FileObject.OpenTextFile (BodytextFile, 1, False, False)
While not InStream.AtEndOfStream
strPageBaseText = strPageBaseText & InStream.ReadLine & vbcrlf
Wend
Set Instream = Nothing
<%
'===============================================
' Page Template Functionality
' ©2001 Cactusoft Ltd. www.cactusoft.com
'===============================================
' You may use the code and functions within this
' template sample application on any web site
' for free providing the comments, copyright
' messages and link to our site are retained.
'
' Queries? Can't promise we can respond to
' everything but try us!
'
'
' mailto:skinsample@cactusoft.com
'===============================================
'-----------------------------------------------
' First we look to read the template location
' from a cookie.
'-----------------------------------------------
strTemplateLocation = request.cookies("templatesample")("templatepath")
'-----------------------------------------------
' If the cookie is blank (i.e. doesn't exist)
' then we set the template to our default one.
'-----------------------------------------------
If request.cookies("templatesample")("templatepath") ="" then
strTemplateLocation="templates/skin_default/"
response.cookies("templatesample")("templatepath") =""
End if
'-----------------------------------------------
' For the datastamp, we create a string of HTML
' which we can add into the page later. Any
' other dynamic text that needs to be included
' on each page can be created in this fashion
' and stored as a string of HTML.
'-----------------------------------------------
strDateStampHTML = Ucase(day(now()) & " " & monthname(month(now())) & " " & year(now()))
'-----------------------------------------------
' This function allows us to read the page HTML
' from the template and store it as a string. We
' then adjust the path of images (so that our
' pages on the root using the template link to
' the correct path of the template's image
' folder. Next we replace the special xxx tags
' in the template with the string content such
' as date that we created above. Finally, we
' split the whole page string into a two-box
' array, with the split made around the
' xxxPAGECONTENTxxx tag. The two sections of
' HTML will later be added above and below the
' main content on each front end page.
'-----------------------------------------------
Function ReadFromTemplate(strTemplateLocation,aryPageTemplate,strDateStampHTML)
'------------------------------------
'LOOP THROUGH TEMPLATE FILE CONTENT
'------------------------------------
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
BodytextFile = Server.MapPath(strTemplateLocation & "main/template.htm")
' Here i get the error Microsoft VBScript-kørselsfejl error '800a004c' . Path not found /game-research/buildpage.asp, line 67
Set InStream= FileObject.OpenTextFile (BodytextFile, 1, False, False)
While not InStream.AtEndOfStream
strPageBaseText = strPageBaseText & InStream.ReadLine & vbcrlf
Wend
Set Instream = Nothing
'------------------------------------
'FORMAT PAGE HTML STRING
'------------------------------------
strPageBaseText = Replace(strPageBaseText,"../images",strTemplateLocation & "images")
'Fix path to template images
strPageBaseText = Replace(strPageBaseText,"../","")
'Adjust hyperlinks on template to correct path
strPageBaseText = Replace(strPageBaseText,"xxxDATESTAMPxxx",strDateStampHTML)
'Add the datestamp to the page by replacing the xxxDATESTAMP tag with the string we created above
aryPageTemplate = split(strPageBaseText ,"xxxPAGECONTENTxxx",-1)
'Create a two-box array by splitting the page HTML around the xxxPAGECONTENTxxx tag
ReadFromTemplate = aryPageTemplate
END Function
%>