You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Daniel <em...@7thfire.com> on 2006/04/28 22:37:04 UTC

strange nesting(?) behavior 1.3.6 -> 2.2.0

Found a piece of oddity. I reread README.v2.txt again this time so I
didn't stumble on something else that was mentioned. The closest thing I
could possibly relate my behavior problems to is this:

"- Nesting must be done properly. I.e. you cannot put a 
tag (for a dynamic table) inside an 'if' and the 
 inside another 'if'.
  (That still works for static tables)"



Here's the code which produeces the problem (this worked in 1.3.6):
===================================================
[- $var="232"; @graph_order = qw(one two three four five six seven
eight); -]
<table>
<tr>
    [- $count = 1 -]
    [$ foreach $graph (@graph_order) $]
        [$ if ($count % 3 == 0) $]
            <td>[+$count+] [+ $graph +]</td>
            </tr> <tr>

        [$ else $]
            <td>notr [+$count+] [+ $graph +]</td>
        [$ endif $]
        [- $count++ -]
    [$ endforeach $]
</tr>
</table>
[+ $var +]

Here is the output:
===================================================
<table>
<tr>
    </tr><tr>
    </tr><tr>

        <td>notr 1 one</td>
        </tr>
</table>
<[+>$var



If this is truly a nested problem, how can I get the functionality I
want? The '<[+>$var' is also interesting.
-- 
"One certain effect of war is to diminish freedom of expression. Patriotism
becomes the order of the day and those who question the war are seen as
traitors, to be silenced and imprisoned." - Howard Zinn

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


RE: strange nesting(?) behavior 1.3.6 -> 2.2.0

Posted by Gerald Richter <ri...@ecos.de>.
> 
> Found a piece of oddity. I reread README.v2.txt again this 
> time so I didn't stumble on something else that was 
> mentioned. The closest thing I could possibly relate my 
> behavior problems to is this:
> 
> "- Nesting must be done properly. I.e. you cannot put a tag 
> (for a dynamic table) inside an 'if' and the  inside another 'if'.
>   (That still works for static tables)"
> 

That's it!

> 
> 
> Here's the code which produeces the problem (this worked in 1.3.6):
> ===================================================
> [- $var="232"; @graph_order = qw(one two three four five six 
> seven eight); -] <table> <tr>
>     [- $count = 1 -]
>     [$ foreach $graph (@graph_order) $]
>         [$ if ($count % 3 == 0) $]
>             <td>[+$count+] [+ $graph +]</td>
>             </tr> <tr>
> 
>         [$ else $]
>             <td>notr [+$count+] [+ $graph +]</td>
>         [$ endif $]
>         [- $count++ -]
>     [$ endforeach $]
> </tr>
> </table>
> [+ $var +]
> 

Tr and if are nested incorrect.


> 
> If this is truly a nested problem, how can I get the 
> functionality I want? 

Yes, that is the problem. You can turn of dynamic table processing by saying

[$ syntax EmbperlBlocks $]

Before your table (you could also put this into the httpd.conf as
Embperl_Syntax)

Gerald


 
** Virus checked by BB-5000 Mailfilter ** 


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org