Re: How to stop (w/o exception)

Attila Szegedi <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
You could enclose your template body in a:

[#macro actuallyRenderThePage]
...
[/#macro]
[@actuallyRenderThePage/]

and then use [#return] from within the macro body. Of course, that  
doesn't address more complex situations, as stopping gracefully from  
several levels of macros or includes. In these cases [#stop/] is the  
only reliable mechanism -- you'll just have to catch and ignore it at  
your point of Template.process() invocation...

Attila.

On 2008.02.26., at 17:44, Newman, John W wrote:

> Hi,
>
> I tried searching but sourceforge is down… I’m sure this has been  
> discussed before.
>
>
> We have the [#stop /] directive which throws an exception.  Is there  
> a way to stop processing gracefully?
>
>
> [#if somethingBad]
>    [#stopGracefully /]
> [/#if]
>
> Sure I could do
>
> [#if ! somethingBad]
>    Everything here
> [/#if]
>
> But I’m pretty sure there is a break or stop thing that should work  
> here.  Just wondering, thanks.






-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.