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

VBScript equivalent of Perl heredoc?

Status
Not open for further replies.

turchinc

Programmer
Feb 1, 2002
2
DE
Hi,
is there a way to emulate perl's heredoc functionality in VBScript?

Basically what I want to do is:

Code:
Response.Write(<<EOF)
<h1>header</h1>
body text...
and finally...

EOF

so that everything between Response.Write and EOF gets printed. I can not write another line of

Code:
strOut = strOut & &quot;my next line of code&quot;

(but I fear I must...)

any tips, help etc. would be appreciated!

Thanks
--chris
 
I don't think you can but just write it in HTML

ie.

<%@ Language=VBScript %>
<% Option Explicit %>
<%
dim dbSha, rsCard, vSql, TbList
TbList=Array(&quot;PLAYER&quot;,&quot;TEAM&quot;,&quot;YEAR&quot;,&quot;BRAND&quot;,&quot;SET&quot;,&quot;INSERT&quot;,&quot;ODDS&quot;,&quot;CARD #&quot;,&quot;SERIAL #&quot;,&quot;COMPLETE SET AVAILABLE&quot;,&quot;JOUEUR&quot;,&quot;EQUIPE&quot;,&quot;ANNÉE&quot;,&quot;COMPAGNIE&quot;,&quot;SÉRIE&quot;,&quot;INSÉRÉE&quot;,&quot;RATIO&quot;,&quot;CARTE #&quot;,&quot;# SÉRIE&quot;,&quot;SÉRIE COMPLÈTE DISPONIBLE&quot;)
set dbSha=server.createObject(&quot;ADODB.Connection&quot;)
set rsCard=server.createObject(&quot;ADODB.Recordset&quot;)
dbSha.open &quot;DRIVER={Microsoft Access Driver (*.mdb)};DBQ=&quot; & server.mappath(&quot;..&quot;) & &quot;/db/db99.mdb&quot;
vSql=&quot;SELECT cards.* FROM cards WHERE (((cards.player)='&quot; & Request.Form(&quot;txtplyr&quot;) & &quot;'));&quot;
rsCard.open vSql,dbSha,1,2,1
%>
<html>
<head>
<title>-----Results-----</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<link rel=&quot;stylesheet&quot; href=&quot;indxstyl.css&quot; type=&quot;text/css&quot;>
<script language=&quot;JavaScript&quot;>
<!--
function MM_callJS(jsStr) { //v2.0
return eval(jsStr)
}
//-->
</script>
<style type=&quot;text/css&quot;>
<!--
body { background-image: url(new3.gif); background-repeat: repeat-y}
-->
</style>
</head>

<body bgcolor=&quot;#000000&quot; leftmargin=&quot;0&quot; topmargin=&quot;0&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; text=&quot;#000000&quot;>
<div id=&quot;Layer1&quot; style=&quot;position:absolute; left:547px; top:1px; width:27px; height:23px; z-index:1; visibility: visible&quot;>
<div align=&quot;center&quot;><a href=&quot;#&quot; onClick=&quot;MM_callJS('window.close()')&quot;>X</a></div>
</div>
<%while not rsCard.EOF %>

and so on...

when it's html write normal
when it's ASP write between <% write here %>

I don't know why you need the &quot;block print&quot; of perl????

If i'm wrong, sorry i didn't get the question..... Have Fun...

Sharky99 >:):O>
 
Hi, thanks for the reply!

The problem is that I am inside of a function that is generating code which it then returns to the main caller in the ASP execution process. I need to save up all of the code I am generating and return it as a string (example: generating a table with different cell values each time etc...)

actually, my example I submitted was a poor one, what I really need to do is something like

Code:
function GenerateTable(intKey)
   strFunctionReturn = << EOF

   (html skeleton code goes here 
   interspersed with code to generate
   the custom values, but ultimately it
   must all go into the variable 
   strFunctionReturn) 

EOF

  ' then I return this to the caller:
  GenerateTable = strFunctionReturn

End Function

Is there a way that I could use your example inside of my function as well? That would be cool.

Regards,
--chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top