problem w/ sandr, send, spec. char, etc.

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

problem w/ sandr, send, spec. char, etc.

Post by Thunderstone »



Hello,

I have some trouble achieving what I want with sandr and send functions.
They do work the way I want them/expect them to, except when the replacement
value contains a '?' in it.
I read that ? is a special char and needs to be escaped, so I tried that,
too.

Consider this example:

<A NAME=display>
<!--
<$toescape = "?">
<$escapewith = "\?">
<sandr $toescape $escapewith $pager>
<$pager = $ret>
-->

<$tags = "__STARTP__" "__STOPP__" "__TOTALP__" "__PAGER__">
<$values = $startp $stopp $totalp $pager>
<sandr $tags $values $inSrTmpl>
<send $ret>
</A>

$pager in this case contains a string like this:
"<A HREF=/cgi-bin/texis/webinator/search?query=oldstring&db=db&jump=10>1</A>
...."

The ? between 'search' and 'query' doesn't get displayed as-is, but rather
gets replaced by:

http://nyc-dev/cgi-bin/texis/q/hquery=z ... db&jump=10
http://nyc-dev/cgi-bin/texis/q/Iquery=z ... db&jump=60
..
that is, in place of '?' I see spaces, other characters, etc.

How should I go about this?

Thanks,

Otis
P.S.
Is this the best way to print $urlq (or any other variable for that matter)
in HTML comments:
<VERB NOESC><!--</VERB>$urlq<VERB NOESC>--></VERB>
it works, but it looks awkward and I'm wondering if I'm missing a more
elegant way of accomplishing the same.
I tried this:
<$junk = ( "<!--" + $urlq + "-->" )>
<send $junk>
but this didn't even work for me :)
Thanks.



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

problem w/ sandr, send, spec. char, etc.

Post by Thunderstone »



? is also special on the search side because the search is a rex expression.
Escape it there too.
<$toescape = "\?">




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

problem w/ sandr, send, spec. char, etc.

Post by Thunderstone »





Actually you probably shouldn't be using <sandr> for this purpose.
<fmtcp SANDBLAST $search $replace> is more appropriate.

It stands for search/replace & blast unlike <sandr> it doesn't
do successive buffer passes against the data for each replace,
and the replacements are strings NOT replace expressions.
It does everything in one pass and sends it to the user.

Its original purpose was to translate special purpose markup
<tags> into the destination html.

Your example below would become:

<$tags = "__STARTP__" "__STOPP__" "__TOTALP__" "__PAGER__">
<$values $startp $stopp $totalp $pager>
<fmtcp SANDBLAST $tags $values>
<read /htdocs/mytemplates/template.html>
<sb>
$ret
</sb>


Whoopie, now you have active server pages / templates.
While we can do this operation much faster than any
other software package, its still less efficient than native
Vortex page building. You might be taking the long way
around the barn.

Thunderstone




Post Reply