[thelist] Including files within Response.write

James Aylard jaylard at encompass.net
Sun Mar 4 17:37:15 CST 2001


Anthony & Michele,

	I don't think there's any way to Response.Write an include per se. Instead,
you would want to end your initial Response.Write after <td
class=""content""> (i.e., "<tr><td class=""content"">") and drop the "&_"
bit immediately following. Then add your include *without* the double set of
quotes around the path (use a single set of quotes only). Your include, if
an asp page, can Response.Write content of its own. It can also be simple
HTML, or straight text.
	Also, you need to terminate your strings at the end of each line with a
close-quote, even if you are continuing the string to the next line
(otherwise the "&_" bit is treated as part of the string, and with no
close-quote, you generate an error). That also means each line that begins
with a string must begin with an open-quote. So, the final result would be
this:

<%
Response.write "</TABLE>" & vbcrlf &_
  "<table border=""0"" cellspacing=""0"" " &_
    "cellpadding=""12"" width=""95%"" align=""center"">" &_
    vbcrlf & "<tr><td class=""content"">"
%>
<!-- #include virtual="/includes/terms.asp" -->
<%
Response.write "</td></tr>" & vbcrlf & "<tr><td class=""content"">" &_
  "<a href=""javascript:history.go(-1)"">&#171;Return</a>" &_
  "</td></tr>" & vbcrlf & "</table>" & vbcrlf
%>

	Also, you wouldn't necessarily have to Response.Write any of this,
depending on how you've constructed your page. You could just make this
straight HTML with an include, such as:

<table border="0" cellspacing="0"
   cellpadding="12" width="95%" align="center">
   <tr>
      <td class="content">
         <!-- #include virtual="/includes/terms.asp" -->
      </td>
   </tr>
   <tr>
      <td class="content"><a
         href="javascript:history.go(-1)">&#171;Return</a></td>
   </tr>
</table>

	If I've missed the boat on any of this, someone correct me. Thanks.

James Aylard





More information about the thelist mailing list