...

View Full Version : Better way?



traffigmgt
04-19-2006, 02:12 PM
Hi,

I'm a bit stuck as I'm trying to achieve this:
From the navigation link on the left I'd like the appropriate page to be loaded in to the content area (to the right) as include files...

Do I use the Select Case or the If statements Or do I just create a template and reload the relevant page each time? (there are about 15 different pages) OR is there a better way?

Please assist and TIA - hope I've explained it well :( .

(NOTE: The Navigation link is also an include file)

degsy
04-19-2006, 03:47 PM
How are you including? Are you using server side includes, Server.Execute, XMLHTTP or another method?


If they are all in the same folder then you can use request.querystring, check if the file exists then include it or execute it.


<%
If Len(Request.QueryString("page")) > 0 Then
filePath = Server.MapPath(".\") & "\" & Request.QueryString("page")
Set fs=Server.CreateObject("Scripting.FileSystemObject")

If (fs.FileExists(filePath))=true Then
Server.Execute(Request.QueryString("page"))
Else
Response.Write("Error: " & Request.QueryString("page") & " not found")
End If

set fs=nothing
End If
%>



<%
If Len(Request.QueryString("page")) > 0 Then
page = Request.QueryString("page")
fileName = Server.MapPath(".\") & "\" & page
Set fs=Server.CreateObject("Scripting.FileSystemObject")

If (fs.FileExists(fileName))=true Then
'Server.Execute(Request.QueryString("page"))
parts = Split(Request.ServerVariables("PATH_INFO"),"/")
For x=0 To Ubound(parts)-1
path = path & parts(x) & "/"
Next
url = "http://" & Request.ServerVariables("HTTP_HOST") & path & page
Response.Write url
set http_obj=server.CreateObject("MSXML2.ServerXMLHTTP")
http_obj.Open "GET", url , false
http_obj.send()
strResponse = http_obj.ResponseText
set http_obj=nothing
Response.Write strResponse
Else
Response.Write("Error: " & page & " not found")
End If

set fs=nothing
End If
%>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum