Re: Simple list of all methods, properties, variables available to templates?

2013-02-16 Thread Nathan Bubna
Yeah, it's not $context.put("context", context) in a template, but
context.put("context", context); in your Java, so that the template
can access $context.  It doesn't contain itself by default.

Similarly, with ClassTool.  You need to put an instance into the
context (context.put("class", new ClassTool()); before you can use
$class

On Fri, Feb 15, 2013 at 2:33 PM, ANS Developer Team  wrote:
> Thanks Nathan, just got a chance to test this.  $context.put("context",
> context) is just being written verbatim, rather than being evaluated.
>
> I've stuck into several different locations (templates, structures,
> content), some of which I know have Velocity processing enabled.
>
> Since it's not being evaluated, does this mean the context doesn't have a
> reference to itself in my CMS?
>
> Tried $class.inspect($context.get($key)), but same result.
>
>
> On Wed, Feb 13, 2013 at 11:08 AM, Nathan Bubna  wrote:
>
>> Yes, if the context has a reference to itself: context.put("context",
>> context);
>> Then you can #foreach( $key in $context.keySet() ) $key =
>> $context.get($key)#end
>> And if you add something like the ClassTool from the VelocityTools
>> project, then you can avoid the nastiness of trying to use the
>> reflection API within a template and explore what
>> $class.inspect($context.get($key)) gives you.
>>
>>
>> http://velocity.apache.org/tools/devel/javadoc/org/apache/velocity/tools/generic/ClassTool.html
>>
>> But again, you need to have access to the VelocityContext being used
>> to merge the templates.  I don't know if your CMS is using
>> VelocityTools, but all of this gets much easier if it is using Tools
>> 2.  There's even a ContextTool:
>>
>> http://velocity.apache.org/tools/devel/javadoc/org/apache/velocity/tools/generic/ContextTool.html
>>
>> On Tue, Feb 12, 2013 at 8:10 PM, ANS Developer Team 
>> wrote:
>> > Thanks, is it possible to do that from within a Velocity template?
>> >
>> >
>> > On Tue, Feb 12, 2013 at 2:09 PM, Sergiu Dumitriu
>> > wrote:
>> >
>> >> On 02/12/2013 12:17 PM, ANS Developer Team wrote:
>> >> > Ah thanks, it's pretty sparse, hence why I'm asking here.  Much
>> >> > appreciated, will figure it out from source.
>> >>
>> >> If you can get your hands on the current VelocityContext, then you could
>> >> list all the properties it contains (it extends Map).
>> >>
>> >> >
>> >> > On Tue, Feb 12, 2013 at 12:42 AM, Nathan Bubna 
>> wrote:
>> >> >
>> >> >> Velocity doesn't provide anything but the syntax.  You will have to
>> >> >> seek documentation from Vosao CMS.
>> >> >>
>> >> >> On Mon, Feb 11, 2013 at 6:57 PM, ANS Developer Team 
>> >> >> wrote:
>> >> >>> Hi all, I'm trying to find a list all of the above that can be used
>> in
>> >> a
>> >> >>> template, preferably with a brief description of what it does (but
>> >> that's
>> >> >>> not entirely necessary).
>> >> >>>
>> >> >>> I'm building site using the Velocity-based Vosao CMS, and have no
>> idea
>> >> >> what
>> >> >>> what methods, properties, and variables are available to me except
>> the
>> >> >>> sparse few used in the example Blog app.
>> >> >>>
>> >> >>> For example there's a $page.friendlyURL property, but what other
>> >> >> properties
>> >> >>> does $page have?  Having trouble finding this information.
>> >> >>>
>> >> >>> I've found the Velocity VTL Reference Guide, but that's more of a
>> >> syntax
>> >> >>> uide without a comprehensive list, and I've found the online
>> Velocity
>> >> API
>> >> >>> docs, but that's overkill and I still can't find the $page object
>> in it
>> >> >>> (not sure what class it's in).
>> >> >>>
>> >> >>> Any help on this much appreciated!
>> >>
>> >>
>> >> -
>> >> 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
>>
>>

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



Re: Simple list of all methods, properties, variables available to templates?

2013-02-16 Thread ANS Developer Team
Ah, got it.  Thanks!


On Sat, Feb 16, 2013 at 12:24 PM, Nathan Bubna  wrote:

> Yeah, it's not $context.put("context", context) in a template, but
> context.put("context", context); in your Java, so that the template
> can access $context.  It doesn't contain itself by default.
>
> Similarly, with ClassTool.  You need to put an instance into the
> context (context.put("class", new ClassTool()); before you can use
> $class
>
> On Fri, Feb 15, 2013 at 2:33 PM, ANS Developer Team 
> wrote:
> > Thanks Nathan, just got a chance to test this.  $context.put("context",
> > context) is just being written verbatim, rather than being evaluated.
> >
> > I've stuck into several different locations (templates, structures,
> > content), some of which I know have Velocity processing enabled.
> >
> > Since it's not being evaluated, does this mean the context doesn't have a
> > reference to itself in my CMS?
> >
> > Tried $class.inspect($context.get($key)), but same result.
> >
> >
> > On Wed, Feb 13, 2013 at 11:08 AM, Nathan Bubna  wrote:
> >
> >> Yes, if the context has a reference to itself: context.put("context",
> >> context);
> >> Then you can #foreach( $key in $context.keySet() ) $key =
> >> $context.get($key)#end
> >> And if you add something like the ClassTool from the VelocityTools
> >> project, then you can avoid the nastiness of trying to use the
> >> reflection API within a template and explore what
> >> $class.inspect($context.get($key)) gives you.
> >>
> >>
> >>
> http://velocity.apache.org/tools/devel/javadoc/org/apache/velocity/tools/generic/ClassTool.html
> >>
> >> But again, you need to have access to the VelocityContext being used
> >> to merge the templates.  I don't know if your CMS is using
> >> VelocityTools, but all of this gets much easier if it is using Tools
> >> 2.  There's even a ContextTool:
> >>
> >>
> http://velocity.apache.org/tools/devel/javadoc/org/apache/velocity/tools/generic/ContextTool.html
> >>
> >> On Tue, Feb 12, 2013 at 8:10 PM, ANS Developer Team 
> >> wrote:
> >> > Thanks, is it possible to do that from within a Velocity template?
> >> >
> >> >
> >> > On Tue, Feb 12, 2013 at 2:09 PM, Sergiu Dumitriu
> >> > wrote:
> >> >
> >> >> On 02/12/2013 12:17 PM, ANS Developer Team wrote:
> >> >> > Ah thanks, it's pretty sparse, hence why I'm asking here.  Much
> >> >> > appreciated, will figure it out from source.
> >> >>
> >> >> If you can get your hands on the current VelocityContext, then you
> could
> >> >> list all the properties it contains (it extends Map).
> >> >>
> >> >> >
> >> >> > On Tue, Feb 12, 2013 at 12:42 AM, Nathan Bubna 
> >> wrote:
> >> >> >
> >> >> >> Velocity doesn't provide anything but the syntax.  You will have
> to
> >> >> >> seek documentation from Vosao CMS.
> >> >> >>
> >> >> >> On Mon, Feb 11, 2013 at 6:57 PM, ANS Developer Team <
> d...@answeb.org>
> >> >> >> wrote:
> >> >> >>> Hi all, I'm trying to find a list all of the above that can be
> used
> >> in
> >> >> a
> >> >> >>> template, preferably with a brief description of what it does
> (but
> >> >> that's
> >> >> >>> not entirely necessary).
> >> >> >>>
> >> >> >>> I'm building site using the Velocity-based Vosao CMS, and have no
> >> idea
> >> >> >> what
> >> >> >>> what methods, properties, and variables are available to me
> except
> >> the
> >> >> >>> sparse few used in the example Blog app.
> >> >> >>>
> >> >> >>> For example there's a $page.friendlyURL property, but what other
> >> >> >> properties
> >> >> >>> does $page have?  Having trouble finding this information.
> >> >> >>>
> >> >> >>> I've found the Velocity VTL Reference Guide, but that's more of a
> >> >> syntax
> >> >> >>> uide without a comprehensive list, and I've found the online
> >> Velocity
> >> >> API
> >> >> >>> docs, but that's overkill and I still can't find the $page object
> >> in it
> >> >> >>> (not sure what class it's in).
> >> >> >>>
> >> >> >>> Any help on this much appreciated!
> >> >>
> >> >>
> >> >> -
> >> >> 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
> >>
> >>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
> For additional commands, e-mail: user-h...@velocity.apache.org
>
>