velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Reck <>
Subject Re: List of variables present in the template?
Date Tue, 27 Nov 2001 08:53:25 GMT
Dan Bachelder wrote:
> it think it would be interesting for debugging occasionally.. although I
> can't think of an example off the top of my head... another think that could
> be useful once and a while (maybe) would be the ability to get a hash where
> the key is the unique $variables and the object is a Collection of values it
> holds in the template(before or after rendering)... I would use this when I
> have particularly complex templates and I am trying to debug a specific
> problem and don't want to dig through the entire bag of schmoo to see if
> something worked... it would make unit tests of template related stuff a bit
> neater too maybe...

I have done this by putting the
context into the context. See the debug template at:

You can see it in action by calling it directly:

The proper solution I have noted in my TODO list is to
create a #context directive that puts the current
(chained-)context into scope for dumping.

Another desired directive would be a #local(names)...#end
which saves the names from the current context (if existing) 
and creates the local ones. These get restored after the #end. 
When used within #macros this would make them safer as a 
predefined generic library.

Now that the user defined directives works, it should be
*very* easy to create these.

:) Christoph

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message