No.  The <&| tag must gather up the content and pass it to the component.

It should be thought of as a sort of control block, like eval{}, so in
compiled form, it looks *vaguely* like this, which would break up
your if statements.

$m->comp_with_content( content => "
  <!-- other html goes here -->
");


Here are a couple alternatives:

 <&| ($thing eq 'somecondition' ? '/some/piped/component/' : 
'/some/passthru/component'), %args >
<!-- where the passthru just returns the content unchanged -->
 </&>

... or ...

 <&| '/some/piped/component/', %args, nevermind => ($thing ne 'somecondition') >
  yada yada yada
 </&>

where the piped component begins with:

$m->print( $m->content ) if $ARGS{nevermind};

... or even ...

% if ($thing eq 'somecondition') {
<&| '/some/piped/component/', %args >
<& stuff &>
</&>
%} else {
<& stuff &>
%}
<%def stuff>
<!-- other html goes here -->
</%def>


~ John Williams


On Wed, 23 Sep 2009, Furst, Carl wrote:

> <%doc>
> Am I allowed to do this:
> </%doc>
> % if ($thing eq 'somecondition') {
> <&| '/some/piped/component/', %args >
> %}
>
>
> <table>
> <!-- other html goes here -->
> </table>
>
> % if ($thing eq 'somecondition') { # same condition as above
> </&>
> % }
>
> <%doc>
> in other words I'm trying to pipe the content through a component if some
> condition is true and non pipe it if it's not.
>
> So far I get a syntax error about a semicolon missing runaway line etc..
>
> If there is a more appropriate way to do this, let me know.. The whole point
> is to not have to repeat the <table>...</table> section in a piped section and
> then again in a non-piped section.. also what if I wanted to use different
> pipes based on several conditions you can easily visualize how convoluted the
> code can get.
>
> Thanks,
>
>
> Carl
> </%doc>
>
>


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to