There's no canonical way of doing this within a template yet, but
there is the IncludeEventHandler which was added in Velocity 1.5.
There is even an IncludeNotFound implementation provided.  You may be
able to set up a simpler, exception free solution using those.
Alternately, you could pretty easily create a VelocityTool that did
this.

On Mon, Dec 29, 2008 at 4:10 AM, Erik Hatcher
<[email protected]> wrote:
> Hi,
>
> I'd like to have some construct like this in a template:
>
>  #if(templateExists($template))
>    #parse($template)
>  #end
>
> Is there a canonical/approved way of doing this?   I've put the
> VelocityEngine into the context and tried:
>
>  #if($engine.resourceExists($template))
>    ...
>  #end
>
> But that still throws an exception when $template does not exist.  I want to
> avoid the exception and simply skip #parse'ing if a template does not exist
>
> Thanks,
>        Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to