View Full Version : all the text in one variable
alaios
04-16-2003, 01:36 PM
Every asp page produce html code.....I want to find the way to take all this html code in to one variableee.....Is there a way?
e.g
<html>
<body>
Response.write "hello"
Response.write "there"
</body>
</html>
so i want the variable to have this value
a="<html><body>hellothere</body></html>"
Plzzz help meeeee
:confused: :confused: :confused: :confused: Every asp page produce html code.....I want to find the way to take all this html code in to one variableee..... :confused: :confused: :confused:
(i'am confused about what you'retrying to do.)
Can you clarify some more and tell us exactly what you want to do?
alaios
04-16-2003, 02:39 PM
I want to put all the html code in to one variable..........For example
Set newmailobj=Createobject("cdonts.newmail")
newmailobj.from=infrom
newmailobj.subject=insubject
newmailobj.bodyformat=cdobodyformathtml
newmailobj.mailformat=cdomailformatmime
newmailobj.body=[B]email[/B}
in the email variable i want to have all the results my asp file...
Well, you can just write it all into one variable and concatinate the html with aspvariables (if necessary), or you can just link strings together.
like this
string="some html code"
string = string + "some other html code" + variable + "html html"
etc
concationating
string =("html" & variable & "html")
Remember: values for html parameters can not be enclosed in double quotes! you can replace them with single quotes or comment them out.
http://www.codingforums.com/showthread.php?s=&threadid=16995&highlight=quotes+comment+out
alaios
04-16-2003, 04:50 PM
This does not help me .My text contains 300 lines of html and 200 of asp.......
Can u find another soultion
Roy Sinclair
04-16-2003, 09:39 PM
Originally posted by raf
...
Remember: values for html parameters can not be enclosed in double quotes! you can replace them with single quotes or comment them out.
http://www.codingforums.com/showthread.php?s=&threadid=16995&highlight=quotes+comment+out
Huh? Don't you know that it's easy to output HTML with double quotes, all you have to do is double the double quotes.
[code]
<%
document.write ("<p id=""para1"">Sample</p>")
%>
I do this all the time and it not only works fine, it outputs the html with properly quoted parameters.
alaios
04-16-2003, 09:59 PM
this does not help me.......Becaue it is not so easy to convert such a big document in asp....
Roy Sinclair
04-16-2003, 10:38 PM
If your html is concentrated into blocks that are seperated from your code and you don't use <%=somevariable%> a lot then you could try putting the html code into a file or several files and use the FileSystemObject to read it/them into a variable. However, if you've got a lot of mixed code then converting it's going to be your best bet.
alaios
04-16-2003, 11:18 PM
Nahhh.... this does not really help me ......Because my boss want to make often changes....so i must find something more efficient....but thanks for your help
miranda
04-17-2003, 01:46 AM
What you are trying to do would be best done with FileSystemObject just as Roy said. Otherwise what you are wanting would slow the server down to a virtual crawl. You never want to concatenate such a large string as the entire contents of a page.
Dim objFso, f, myfile
myfile = Server.MapPath("index.html")
Set objFso = Server.CreateObject("Scripting.FileSystemObject")
Set f = objFso.OpenTextFile(myfile, 1)
While f.AtEndOfStream = false
Response.Write Server.HTMLEncode(f.ReadLine)
Response.write "<br>"
Wend
f.close
Set f = Nothing
Set objFso = Nothing
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.