Wrox Home  
 
Search P2P Archive for  go

More Wrox Resources

  Return to Index  

asp_web_howto thread: Re: convert .asp files to .htm


Message #1 by "craig malcolm" <malcolm@i...> on Mon, 28 Jan 2002 11:02:39
 I have tried the below code, but it has not worked, can anyone help- 

Please

 <%  Dim fso, MyFile, StrHTML

   

   StrHTML = "<HTML><h2>[should this be Page name???]</h2></HTML>"



   Set fso = CreateObject("Scripting.FileSystemObject")

   Set MyFile = fso.CreateTextFile("[should I create this page or will it 

create itself???", True)

   MyFile.WriteLine(StrHTML)

   MyFile.Close



%>



THANKS



Just Use the FileSystemObject. it will cost you a few lines like this:

> 

> 

>    

> 

>    Dim fso, MyFile, StrHTML

>    

>    StrHTML = "<HTML><h2>www.waltersworld.nl</h2></HTML>"

> 

>    Set fso = CreateObject("Scripting.FileSystemObject")

>    Set MyFile = fso.CreateTextFile("c:\test.html", True)

>    MyFile.WriteLine(StrHTML)

>    MyFile.Close

> 

> Just try it

Message #2 by "Drew, Ron" <RDrew@B...> on Mon, 28 Jan 2002 08:14:18 -0500
Lets say we use your CreateObject below.

fso.CreateTextFile will create the file specified for you.  The

parameter True will Overwrite an existing file with that name if it

exists.  If you do not want to overwrite, use False.

After you create the file, you can now write to it using the

fso.OpenTextfile

Fso.OpenTextFile("yourfile.txt",x,y)  

   x=3D 1 to Read, 2 to overwrite or 8 to append

   y=3D -1 if you created the file in Unicode format or -2 to specify 

the

systems default(I never use this one)

If you want to display the data in the file, I normally use the <pre>

and </pre> so it shows exactly as in the file or it will appear with no

line breaks or blank lines.

So...Try this...

<%  Dim fso, MyFile

   Set fso =3D CreateObject("Scripting.FileSystemObject")

   Set MyFile =3D fso.CreateTextFile("newfile.htm", True)

   MyFile.WriteLine "<HTML><h2>Your Page Name</h2></HTML>"

   MyFile.Close

%>

Hope it helps





-----Original Message-----

From: craig malcolm [mailto:malcolm@i...]

Sent: Monday, January 28, 2002 6:03 AM

To: ASP Web HowTo

Subject: [asp_web_howto] Re: convert .asp files to .htm





 I have tried the below code, but it has not worked, can anyone help-

Please

 <%  Dim fso, MyFile, StrHTML

  

   StrHTML =3D "<HTML><h2>[should this be Page name???]</h2></HTML>"



   Set fso =3D CreateObject("Scripting.FileSystemObject")

   Set MyFile =3D fso.CreateTextFile("[should I create this page or will

it

create itself???", True)

   MyFile.WriteLine(StrHTML)

   MyFile.Close



%>



THANKS



Just Use the FileSystemObject. it will cost you a few lines like this:

>

>

>   

>

>    Dim fso, MyFile, StrHTML

>   

>    StrHTML =3D "<HTML><h2>www.waltersworld.nl</h2></HTML>"

>

>    Set fso =3D CreateObject("Scripting.FileSystemObject")

>    Set MyFile =3D fso.CreateTextFile("c:\test.html", True)

>    MyFile.WriteLine(StrHTML)

>    MyFile.Close

>

> Just try it






$subst('Email.Unsub').

Message #3 by "craig malcolm" <malcolm@i...> on Tue, 29 Jan 2002 09:55:14
Thanks for your help, but somewhere I am getting totally confused, and its 

driving me barmy. 

I have created a form,(in an asp page) which contains the folowing table ( 

user details ) and I need to submit the shopping cart details in html 

format.As the page is in asp the user details go through fine to the email 

address, but the <%DisplayShoppingCart%> appears with the table 

tags<Table><tr> etc. So I am needing to convert this ASP page to an HTML 

page.

I have tried inserting your method in all sorts of ways, but it always 

comes up with an error. Where am I going wrong?

<table>

<TR><TD><B>Date : </TD><td><INPUT TYPE="text" NAME="Date" 

SIZE=20></TD></TR>

<TR><TD><B>E-Mail Address </TD><td><INPUT TYPE="text" NAME="Email Address" 

SIZE=30></TD></TR>

<TR><TD><B>Company Name : </TD><td><INPUT TYPE="text" NAME="Company Name" 

SIZE=51></TD></TR>

<TR><TD><B>Name : </TD><td><INPUT TYPE="text" NAME="Name" 

SIZE=51></TD></TR>

</Table>



<input type='hidden' name='body'  value='<%DisplayShoppingCart%>'>

Where do I insert the below Code? How do I call up the html page?

Should I first change the asp page to an html page , before inserting the 

form?( This now sounds like the best Idea)I am still a beginner with asp, 

so please dont laugh.How would I send <%DisplayShoppingCart%> to an html 

page as per your below method?

Thanks for any help you can offer.





> Lets say we use your CreateObject below.

> fso.CreateTextFile will create the file specified for you.  The

> parameter True will Overwrite an existing file with that name if it

> exists.  If you do not want to overwrite, use False.

> After you create the file, you can now write to it using the

> fso.OpenTextfile

> Fso.OpenTextFile("yourfile.txt",x,y)  

>    x=3D 1 to Read, 2 to overwrite or 8 to append

>    y=3D -1 if you created the file in Unicode format or -2 to specify 

> the

> systems default(I never use this one)

> If you want to display the data in the file, I normally use the <pre>

> and </pre> so it shows exactly as in the file or it will appear with no

> line breaks or blank lines.

> So...Try this...

> <%  Dim fso, MyFile

>    Set fso =3D CreateObject("Scripting.FileSystemObject")

>    Set MyFile =3D fso.CreateTextFile("newfile.htm", True)

>    MyFile.WriteLine "<HTML><h2>Your Page Name</h2></HTML>"

>    MyFile.Close

> %>

> Hope it helps

> 




  Return to Index