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

Save ASP output as html file

Status
Not open for further replies.

sickpuppy

Technical User
Feb 22, 2001
40
0
0
GB
Hi
I am returning a recordset showing job details and need to save this as an html file for further processing.

I understand that I need to use FSO and all works fine with plain text but not when trying to incorporate text dynamically created from the returned recordset.

Anyone tried this before?
 
Well you just need to make an ASP page that displays the right html format of your recordset and then use instead of
Response.Write just concatenate strings. and final step it's to create file and save the variable to a file.

str=&quot;<html>&quot;
str=str&&quot;<body>&quot;
'now put your table data here
str=str&&quot; put your table data here&quot;
...

set fso=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
set f=fso_OpenTextFile(&quot;mypage.htm&quot;)
f.Write str

this should be the steps.

Tell us what you need help with


________
George, M
 
this is confusing me mightily. Does this mean I start with usual page definitions and then

<%
str=&quot;<html>&quot;
str=str&&quot;<body>&quot;
str=str&&quot;<table>&quot;

str=str&&quot;<tr><tr>

but then what? how do I incorporate the live data without using &quot; ?
 
Ok we might misunderstood each other what do you want to acomplish? You want to pass something to another page? or just to save the response to an static html file?

________
George, M
 
I am trying to save a set of customer order details, generated via recordset & asp page, into a static html page that is saved on the server.

I can use the following after defining recordset:

<%
Dim objFileSystem
Dim MyFile
Set objFileSystem = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set MyFile = objFileSystem.CreateTextFile(&quot;f:\test\NewlyCreatedFile.html&quot;, True)

MyFile.WriteLine &quot;<HTML>&quot;
MyFile.WriteLine &quot;<HEAD>&quot;
MyFile.WriteLine &quot;<TITLE>Creating an HTML file...</TITLE>&quot;
MyFile.WriteLine &quot;</HEAD>&quot;
MyFile.WriteLine &quot;<BODY>&quot;

However, I am struggling on how to incorporate the dynamic elements within the static html tags.

Hope this is clearer
 
Ah now i got it, it should be verry easy...
You make your own tags like ##name here## and save it as a html template for the files.
Then you read the files replace the tags and then save the file as it should be(dont save over the template file) or just output to the browser.
I use this if i want to send an email.
I have a template file with ##subject##... etc tags and then i just replace those tags and send the email.
If i want to change the desight i just change the template file.

________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top