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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Include an html page in an ASP script

Status
Not open for further replies.

hp12

Programmer
Nov 10, 2002
3
CA
I have an ASP script where I generate a table. Each cell is a different html page. The main cell is generated dynamically.

I cannot use an include because the path has to be hard coded.
Hi everyone!!

I cannot use a Server.Transfer or Server.Execute because it looks for any images reference in the same folder as the asp.

I am creating this page for a group of users and I want to allow them to put the html and images in one folder.

Can anyone please tell me if there is another way to reference an html page within a table cell dynamically and not use include, server.execute or server.transfer.


Thanks!!!time a table cell is
 
why not use include? you can specify a virtual path:

<!-- #include file=&quot;/someFolder/another/file.html&quot; -->

this would be the same as hard-coding &quot; as the path...this method will work at any level in the folder tree since it starts at the root &quot;/&quot;

=========================================================
if (!succeed) try();
-jeff
 
I need to create the path dynamically. I have to come back to this asp page everytime a link is selected and it will create the link at the top.

Here is my code:

<%
Dim pagesrc, menu, page, fs, fo
set fs=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
set fo=fs.GetFolder( Server.MapPath( &quot;/&quot; ) )
pagesrc = Request.QueryString(&quot;page&quot;)
menu = Request.QueryString(&quot;menu&quot;)
page=fo &&quot;/&quot;& menu&&quot;/&quot;& pagesrc & &quot;/&quot;&pagesrc&&quot;.html&quot;
If (fs.FileExists(page)) = false Then
pagesrc=&quot;Home&quot;
menu=&quot;Top_Menu&quot;
End If
page= menu&&quot;/&quot;& pagesrc & &quot;/&quot;&pagesrc&&quot;.html&quot;
%>
<html>
<head>

<script language=javascript>

</script>
</head>
<body>



<table border=1>
<tr>
<td rowspan=2>
<img src=&quot;logo.jpg&quot;>
</td>
<td>
<img src=&quot;school_name.jpg&quot;>
</td>
</tr>
<tr>
<td>
<!--#include file=&quot;banner.asp&quot;-->
</td>
</tr>
<tr>
<td valign=top>
<!--#include file=&quot;menu.asp&quot;-->
</td>
<td>
<%
********** HERE IS MY PROBLEM *******
Server.Execute(page)
%>

</td>
</tr>

</table>
</body>
</html>
 
could u be more specific ...of what u're trying to create in your asp page, specially in your
Code:
<td ></td>
tag ???
 
Sure,

This is a webpage with a menu across the top (banner.asp). Every time you click on a link in the top menu, it will refer you back to the page with the code displayed above (index.asp). banner.asp passes in 2 variables, &quot;top_menu&quot; and the name of the link pressed (ie.&quot;home&quot;) so the cell will link to top_menu/home/home.html (path)

&quot;path&quot; is the link I am trying to display in the table cell (between <td ></td>)
 
Could you use something like this, this means you can dynamically include a file into your page

whichfile=&quot;FileToRead&quot;
Set fs = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set thisfile = fs.OpenTextFile(whichfile, 1, False)
tempSTR=thisfile.readall
response.write tempSTR
thisfile.Close
set thisfile=nothing
set fs=nothing Saturday 12.00
im6.gif
im2.gif
im2.gif
20.00
im5.gif
im4.gif
im7.gif
3.00am
im8.gif
Sunday [img http
 
Or you could set up a case statement with all the possible includes and then it would include all of them but only process the one related to the users click:
Code:
<td>
   <% 
   '********** HERE IS MY PROBLEM *******
   'Server.Execute(page)
   Select Case(page)
      Case &quot;home&quot;
         %><!--#include file=&quot;home/home.html&quot;--><%
      Case &quot;otherstuff&quot;
         %><!--#include file=&quot;home/otherstuff.html&quot;--><%
      Case &quot;mylinks&quot;
         %><!--#include file=&quot;home/mylinks.html&quot;--><%
      Case Else
         %><!--#include file=&quot;home/linkerror.html&quot;--><%
   End Select
   %>
</td>

Just another point of view,
-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...) :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top