You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Kee Hinckley <na...@somewhere.com> on 2002/08/17 22:54:28 UTC
Passing html to a function from within an HTML file.
I'm flumuxed.
Here's a function that takes either a label and some html, or a
label, a hashref and a name. It outputs a table row.
$ sub ShowRow $]
[# label html OR label hashref name #]
<tr valign=top>
<td>[+ $_[1] +]:</td>
<td>
[$ if (UNIVERSAL::isa($_[2], 'HASH') ||
substr("$_[2]",0,1) eq '*') $]
[+ $_[2]->{$_[3]} +]
[$ else $]
[- do {local($escmode) = 4; print OUT $_[2]; } -]
[$ endif $]
</td>
</tr>
[$ endsub $]
Here's a call in the hashref form
[- $this->ShowRow('UserID', $user, 'userid') -]
Works fine.
Here are two calls in the HTML form
[- $this->ShowRow('Name',
"$fdat{prefix} $fdat{fname} $fdat{mname} $fdat{lname}
$fdat{suffix}") -]
[- $this->ShowRow('Address',
"$fdat{addr1}<br>$fdat{addr2}<br>$fdat{city}, $fdat{state}
$fdat{postalcode}") -]
In the latter case all the HTML tags disappear. If I use < and
> instead of < and > they work fine. $escmode is set to 7.
Is there any way to make this work (without resetting escmode before
each call to the function--not that I can get that to work either
--
Kee Hinckley - Somewhere.Com, LLC
http://consulting.somewhere.com/
I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Passing html to a function from within an HTML file.
Posted by "Luiz Fernando B. Ribeiro" <li...@athome.pro.br>.
Oi Kee,
Resposta a sua mensagem de sábado, 17 de agosto de 2002:
Kee> I'm flumuxed.
Kee> ...
Kee> Is there any way to make this work (without resetting escmode before
Kee> each call to the function--not that I can get that to work either
Try escaping the opening tag, this way:
\<br> \<a href="">Text\</a>
This have always worked for me.
Regards,
Luiz Fernando B. Ribeiro
Engenho Soluções para a Internet
luiz@engenhosolucoes.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Passing html to a function from within an HTML file.
Posted by Ed Grimm <ed...@asgard.rsc.raytheon.com>.
1.3 or 2.0?
I seem to recall running into this issue in 1.3, and it was that the
string was being parsed before it was sent to the function, so setting
$escmode in the function didn't help (much). We fixed it by setting
$escmode to 0, and then we set it to 7 right before outputing user input
data, and back to zero right after.
Ed
On Sat, 17 Aug 2002, Kee Hinckley wrote:
> I'm flumuxed.
>
> Here's a function that takes either a label and some html, or a
> label, a hashref and a name. It outputs a table row.
>
> $ sub ShowRow $]
> [# label html OR label hashref name #]
> <tr valign=top>
> <td>[+ $_[1] +]:</td>
> <td>
> [$ if (UNIVERSAL::isa($_[2], 'HASH') ||
> substr("$_[2]",0,1) eq '*') $]
> [+ $_[2]->{$_[3]} +]
> [$ else $]
> [- do {local($escmode) = 4; print OUT $_[2]; } -]
> [$ endif $]
> </td>
> </tr>
> [$ endsub $]
>
>
> Here's a call in the hashref form
> [- $this->ShowRow('UserID', $user, 'userid') -]
> Works fine.
>
> Here are two calls in the HTML form
> [- $this->ShowRow('Name',
> "$fdat{prefix} $fdat{fname} $fdat{mname} $fdat{lname}
> $fdat{suffix}") -]
> [- $this->ShowRow('Address',
> "$fdat{addr1}<br>$fdat{addr2}<br>$fdat{city}, $fdat{state}
> $fdat{postalcode}") -]
>
>
> In the latter case all the HTML tags disappear. If I use < and
> > instead of < and > they work fine. $escmode is set to 7.
>
> Is there any way to make this work (without resetting escmode before
> each call to the function--not that I can get that to work either
> --
>
> Kee Hinckley - Somewhere.Com, LLC
> http://consulting.somewhere.com/
>
> I'm not sure which upsets me more: that people are so unwilling to accept
> responsibility for their own actions, or that they are so eager to regulate
> everyone else's.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org