Mike,

What about calling #parse and other (?) types of includes? Same thing with 
macros which call other macros etc. Velocity must already know what’s going on. 
Can’t the template get access to that?

-chris

> On May 3, 2023, at 17:30, Mike Kienenberger <mkien...@gmail.com> wrote:
> 
> Rather than trying to get the internal name, you'd probably be better off
> injecting the name yourself.  You normally have access to the name of the
> template around the same time that you set up the context.
> 
> 
>> On Wed, May 3, 2023 at 11:42 AM Christopher Schultz <
>> ch...@christopherschultz.net> wrote:
>> 
>> All,
>> 
>> I'd like too be able to get access to the name of the template currently
>> being rendered. It looks like that information should be in the
>> VelocityContext being used, but I'm having trouble getting a reference
>> to that.
>> 
>> This is in a webapp situation, and I'm using velocity-tools so I tried
>> the ContextTool which will give me a ChainedContext which implements the
>> Context interface but I'm not sure where to go from there. For example,
>> I don't see a way to walk my way up the chain to the
>> most-parent-context, or really anything that would give me access to
>> e.g. getCurrentTemplateName.
>> 
>> Is there a "standard" way to do this?
>> 
>> I'm using Velocity 1.7 at this point (yeah, I know). I'm perfectly happy
>> to hack it a little bit and I already have a custom
>> VelocityLayoutServlet with a custom mergeTemplate method, so ther is an
>> opportunity there to inject some instrumentation.
>> 
>> Thanks,
>> -chris
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
>> For additional commands, e-mail: user-h...@velocity.apache.org
>> 
>> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
For additional commands, e-mail: user-h...@velocity.apache.org

Reply via email to