 |
| Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

July 1st, 2004, 06:35 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
ASP Page within ASP Page display
Is it possible to load an external ASP page into an existing one. I've tried using FileSystemObject and Server.Execute, but it shows the data contained in page2 in either the wrong place (filesystemobject) or outside of the table (server.execute).
the reason i have this is because i have a table generated from a database, and each product has it's own description. i want to load let's say "01.asp" for product1 and "02.asp" for product2.
I have the following in my code:
"<table + properties>"
While not objRS.EOF
<tr>
<td>description here</td>
</tr>
objRS.MoveNext
Wend
"</table>"
description here should house the "external asp" pages. is it possible to do that or not?
michael j hemmington
__________________
michael j hemmington
|
|

July 1st, 2004, 06:49 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Humm use Include or script method...
<script src="/public/scripts/unistats.php" language=PHP></script>
Stay Beautiful,
Abdul Salam
|
|

July 1st, 2004, 07:29 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Abdul, you are showing a PHP method for doing this. Pharasite wishes for ASP.
Try using a server-side include.
HTH,
Snib
<><
|
|

July 1st, 2004, 08:37 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Michael,
Could you post the code that you use in "01.asp"? That should be useful to know what you are trying to exactly.
Cheers!
_________________________
- Vijay G
Strive for Perfection
|
|

July 2nd, 2004, 02:20 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
<%
Dim objFSO, listFile, followPath
objConn.Open strConnec
objRS.Open "Products", objConn, adOpenStatic, adLockReadOnly, adCmdTable
objRS.Filter= "Prod_Code LIKE '%CR21%'"
%>
<table border="0" cellpadding="0" cellspacing="0">
<%
While Not objRS.EOF
%>
<tr>
<td width="223px" height="147px">
<table border="0" cellpadding="0" cellspacing="0" width="223px" height="147px">
<tr>
<td width="5" height="120"> </td>
<td colspan="2" width="213" valign="middle" align="center"><img src="prod-bin/creative/images/2.1/<%=objRS("Prod_Image")%>.png"></td>
<td width="5"> </td>
</tr>
<tr>
<td colspan="2" width="106" height="27px" align="center"><strong>R</strong> <%=objRS("Prod_Price")%></td>
<td colspan="2" width="106" align="center"><img src="images/AtCart.png"></td>
</tr>
</table>
</td>
<td width="348px">
<div id="description" style="position: inherit; width: 348px; height: 147px; z-index: inherit; background-color: #FFFFFF">
<--- This is were i would like to loop out the specific page that the While-Wend statement loops out --->
</div>
</td>
</tr>
<%
objRS.MoveNext
Wend
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>
michael j hemmington
|
|

July 3rd, 2004, 06:18 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Actually I was looking for the code that you use in the "description here" area, the one that you feel differs from product to product. In what ways that description differs? And why can you adapt that in one such file thatn going for a file each for different product?
Can you explain more on that and post some code from there too?
Also I would suggest that you use SELECT statement than using a filter there.
Code:
objConn.Open strConnec
objRS.Open "Select * from Products where Prod_Code LIKE '%CR21%'", objConn, adOpenStatic, adLockReadOnly
Cheers!
_________________________
- Vijay G
Strive for Perfection
|
|

July 5th, 2004, 02:13 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You mean the code the following ...
<%
Dim objFSO, listFile, ePath
ePath = Server.MapPath("products/desc/" & objRS("Desc") & ".asp") 'I want this to loop out the correct page to display
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set listFile = objFSO.OpenTextFile(ePath,1,FALSE)
Do While Not listFile.AtEndOfStream
Response.Write(listFile.ReadLine)
Response.Write("<br>")
Loop
'Close and Set = Nothing
%>
This is the code that should come in by the part I referred to as <--- This is were i would like to loop out the specific page that the While-Wend statement loops out --->, in the above mentioned code.
michael j hemmington
|
|

July 5th, 2004, 12:14 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Michael,
You may have a look at this article
Dynamic Includes
Cheers!
_________________________
- Vijay G
Strive for Perfection
|
|

July 23rd, 2004, 06:57 AM
|
|
Registered User
|
|
Join Date: Jul 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi!
It is possible to include an ASP-page into another one. Use the IFRAME HTML-tag. Se example below:
<IFRAME id="previewframe" width="205" height="105" src="Preview.asp"></IFRAME>
Of course you have to set the src-attribute dynamically on the fly to the correct page...but that shouldn't be a problem. And of course surround the tag with the usual TABLE/TR/TD-tags that makes it fit into your page the way you want it to.
Bjorn
|
|
 |