escaping quotes

Post Reply
User avatar
Thunderstone
Site Admin
Posts: 2504
Joined: Wed Jun 07, 2000 6:20 pm

escaping quotes

Post by Thunderstone »



How do you escape quotes within double quoted strings?

I want the following result:
<!--#include virtual="public/head.htm"-->

using <send "<!--#include virtual="public/head.htm">

The quotes MUST be included within a double quoted string
literal since I have to use send within an <exec> to get our SSI
to function properly.



User avatar
Thunderstone
Site Admin
Posts: 2504
Joined: Wed Jun 07, 2000 6:20 pm

escaping quotes

Post by Thunderstone »




Same way as in HTML: use single quotes to enclose the string instead of
double quotes.


Use: <send '<!--#include virtual="public/head.htm">'>


I don't know what your overall goal is, but check to see if
it can be accomplished entirely withing the Vortex script, perhaps with
<spew> to send files or <fetch> for URLs. In general you should think
carefully before <EXEC>ing another program or using SSI, because these
incur additional overhead and parsing that may not be necessary.

-Kai


hillman
Posts: 25
Joined: Mon Apr 08, 2002 9:06 am

escaping quotes

Post by hillman »

Doesn't seem to work within a fmt or strfmt function?

<strfmt '<A HREF="$s">%s</A><br />' $URL $TITLE>

... produces:

Argument must be single variable or literal in the function: ()

I also tried:

<sum %s '<A HREF="' $URL '">' $TITLE '</A><br />'>

... and got:

Missing start double quotes in function: ()
hillman
Posts: 25
Joined: Mon Apr 08, 2002 9:06 am

escaping quotes

Post by hillman »

Sorry, my mistake! The first example does work, it's just I mixed a '$' for a '%' in the first %s.
User avatar
John
Site Admin
Posts: 2580
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

escaping quotes

Post by John »

You want:

<strfmt '<A HREF="%s">%s</A><br />' $URL $TITLE>

To print the URL in the function with a fmt code.

To get a dollar sign in a string literal you need to double it up.
John Turnbull
Thunderstone Software
Post Reply