Stupid ASP question

  • Thread starter Thread starter Jack Brewster
  • Start date Start date
J

Jack Brewster

Using ASP 3.0. How do you assign a large block of HTML to a variable
without having to escape all your quotes, etc.

An example of what I'm asking, this code:

myvar = "<div id=""header"">" & vbCrLf &_
"Stuff in the header" & vbCrLf &_
"</div>"

would output:
<div id="header">
Stuff in the header
</div>

Whereas this code:
myvar = "<div id="header">
Stuff in the header
</div>"

Would fail because it's multilined and the quotes in the id= aren't escaped
("").

Thanks!
 
Unfortunately, Jack, if you're building a string, that's about your only
choice. Only other workaround would be to put all of that HTML into a file,
and read the file into a string variable.

--
HTH,

Kevin Spencer
..Net Developer
Microsoft MVP
http://www.takempis.com
Big things are made up
of lots of little things
 
Kevin Spencer said:
Unfortunately, Jack, if you're building a string, that's about your only
choice. Only other workaround would be to put all of that HTML into a file,
and read the file into a string variable.

Bah humbug.

I was trying to avoid using an external file. I'm exploring a template
engine which means I've already got an external template file, the included
template engine, and the calling file itself. Creating an extra external
file would mean doubling up all the files - one calling .asp file, and a
second content file.

Who wrote this language, anyway?!?!

So, are you using a templating method at all, or just hand building
everything?

Thanks,

Jack
 
I haven't worked with ASP for over a year. Doing all ASP.Net now, I'm
afraid. When I was doing ASP, I did some templated web sites. The ones I did
used a table for the template, so I could add borders and such if needed. I
split the table right in the middle of the center cell and put the 2 halves
in 2 include files. My ASP templated pages had server-side includes at the
top and bottom to place themselves "in" the table. Never had to store more
than a little HTML in a string variable, though.

--
HTH,

Kevin Spencer
..Net Developer
Microsoft MVP
http://www.takempis.com
Big things are made up
of lots of little things
 
Kevin Spencer said:
I haven't worked with ASP for over a year. Doing all ASP.Net now

Alright, in one paragraph or less, what's the biggest hurdle to switching to
ASP.Net? Especially for someone who can write adequate (but not inventive)
ASP in VBS, but doesn't know squat about VB or C(any)?
 
I couldn't give anyone a "biggest" hurdle. Jim's suggestion is certainly up
there, but you also have the entire .Net platform, configuration files,
Common Language Runtime, etc. to learn about, as well as the ASP.Net
programming paradigm and object model. It's a huge learning curve, but well
worth the effort. Microsoft has also done an excellent job of providing
helpful documentation, not only in the MSDN Library, but also in the freely
downloadable .Net SDK -

http://www.microsoft.com/downloads/...b5-c7a7-4505-9927-2213868a325b&DisplayLang=en

The .Net SDK is some of the best documentation on any software that I've
ever seen. Not only is the documentation well organized and
cross-referenced, but it also includes articles, tutorials, and sample code
that can really get you over the hurdles.

--
HTH,

Kevin Spencer
..Net Developer
Microsoft MVP
http://www.takempis.com
Big things are made up
of lots of little things

Jim Cheshire said:
I'll give you my take. Your biggest hurdle is going to be in rethinking the
way you design applications. ASP is written using VBScript or JScript
primarily as inline script in your HTML pages. ASP.NET applications are
object-oriented applications. If you aren't used to writing object-oriented
code, it's a fairly large learning curve.

--
Jim Cheshire
Jimco Add-ins
Add-ins for FrontPage 2000-2003
http://www.jimcoaddins.com
===============================
Co-author of Special Edition
Using Microsoft FrontPage 2003


Jack Brewster said:
Alright, in one paragraph or less, what's the biggest hurdle to
switching
 
I may even take a college class for it if one is available in my area.
seriously.

Kevin Spencer said:
I couldn't give anyone a "biggest" hurdle. Jim's suggestion is certainly up
there, but you also have the entire .Net platform, configuration files,
Common Language Runtime, etc. to learn about, as well as the ASP.Net
programming paradigm and object model. It's a huge learning curve, but well
worth the effort. Microsoft has also done an excellent job of providing
helpful documentation, not only in the MSDN Library, but also in the freely
downloadable .Net SDK -

http://www.microsoft.com/downloads/details.aspx?FamilyID=4fe5bdb5-c7a7-4505-
9927-2213868a325b&DisplayLang=en

The .Net SDK is some of the best documentation on any software that I've
ever seen. Not only is the documentation well organized and
cross-referenced, but it also includes articles, tutorials, and sample code
that can really get you over the hurdles.

--
HTH,

Kevin Spencer
.Net Developer
Microsoft MVP
http://www.takempis.com
Big things are made up
of lots of little things
 
You can use single quotes instead of double quotes and you won't need to
escape them.

An example of what I'm asking, this code:
myvar = "<div id='header'>" & vbCrLf &_
"Stuff in the header" & vbCrLf &_
"</div>"

And the output will be
<div id='header'>
Stuff in header
</div>

Which works just fine. That's how I escape double quotes in my asp but I'm
lazy and take the easy way out since writing real code as opposed to html
isn't on my top 10 list..<grin />
 
You are correct. Double-quotes are required.

--
Jim Cheshire
Jimco Add-ins
Add-ins for FrontPage 2000-2003
http://www.jimcoaddins.com
===============================
Co-author of Special Edition
Using Microsoft FrontPage 2003
 
You could always write your ASP in JScript. :)

--
Jim Cheshire
Jimco Add-ins
Add-ins for FrontPage 2000-2003
http://www.jimcoaddins.com
===============================
Co-author of Special Edition
Using Microsoft FrontPage 2003
 
Oh well. :) You know RFCs. Good today, bad tomorrow. :)

--
Jim Cheshire
Jimco Add-ins
Add-ins for FrontPage 2000-2003
http://www.jimcoaddins.com
===============================
Co-author of Special Edition
Using Microsoft FrontPage 2003
 
Okay, I'm having a brain dead moment (maybe day, who knows) but what is
RFCs?

Been spending way too much time over on eBay trying to find a good deal on a
world phone before I leave for the UK Accessibility conference next month.
Why can't there actually be a real standard worldwide in anything? 3
different types of cellular system and at least 4 different bands none of
which will work with the other unless the phone already supports mult-band,
multi-mode and very few of them do. Okay, time to end off topic rant and get
back to watching my eBay bids.
--
Cheryl D. Wise
www.wiserways.com
Microsoft MVP-FrontPage

Jim Cheshire said:
Oh well. :) You know RFCs. Good today, bad tomorrow. :)

--
Jim Cheshire
Jimco Add-ins
Add-ins for FrontPage 2000-2003
http://www.jimcoaddins.com
===============================
Co-author of Special Edition
Using Microsoft FrontPage 2003
http://validator.w3.org/check?uri=h...+automatically)&doctype=Inline&ss=1&verbose=1
 
Cheryl D. Wise said:
Okay, I'm having a brain dead moment (maybe day, who knows) but what is
RFCs?

They are the Holy Writ from W3 that define the language, syntax,
requirements, etc. Not sure what RFC actually stands for (Request For
Comment?) but here's the spec for XHTML 1.1:
http://www.w3.org/TR/xhtml11/

Some definition links that seem to prove I'm correct on what RFC is:
http://dictionary.reference.com/search?r=67&q=rfc
http://www.acronymfinder.com/af-query.asp?p=dict&String=exact&Acronym=RFC
 
An RFC is a "Request for Comments" and is how a new standard is proposed.
They really aren't standards per se but provide a way to get everyone on the
same page.

--
Jim Cheshire
Jimco Add-ins
Add-ins for FrontPage 2000-2003
http://www.jimcoaddins.com
===============================
Co-author of Special Edition
Using Microsoft FrontPage 2003
 
Back
Top