The first question is more of a Velocity question (recommend subscribing to
Velocity-User list), but in short, any $var reference in a template that is
not explicity set via chucking something in the context will ouput as you
see.  This allows you to 'place' var tags wherever you want, and slowly fill
the context as you develop and see how things look.

If you really don't want to display anything, then you use the quiet
notation, which is the $!var syntax.

2nd Question: I would think so, but don't quote me on that... ;)  You can
also get access to the Context object in the isAuthorized(RunData) method by
doing the following sneaky trick:

Context context = TurbineVelocity.getContext(data);

If you look under the hood of Turbine, you will see that the RunData
maintains a reference inside it, and so the above call either ensures a new
one is referenced and returned, or the current reference is returned. This
allows you to play with the Context from a method that only has access to
the RunData instance.

cheers,

Paul Smith

> -----Original Message-----
> From: Ryan Austin [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 13 December 2002 3:54 PM
> To: Turbine Users List
> Subject: Re: $data not available in Default.vm in layouts directory
> 
> 
> Ok, thanks for that info. The turbine Velocity Site how-to 
> uses brackets?
> 
> So, if there are not any messages and I use $data.getMessage(), is it
> supposed toshow up as '$data.getMessage()'
> after the template is expanded?
> 
> Also, if I set a Message in SecureScreen.java isAuthorized() 
> method, would
> that message be available
> in the Default layout template?
> 
> Thanks,
> Ryan
> 
> 
> ----- Original Message -----
> From: Paul Smith <[EMAIL PROTECTED]>
> To: 'Turbine Users List' <[EMAIL PROTECTED]>
> Sent: Thursday, December 12, 2002 8:26 PM
> Subject: RE: $data not available in Default.vm in layouts directory
> 
> 
> > There are no {} in Velocity, try:
> >
> > #if ($data.getMessage())
> >    $data.getMessage()
> > #end
> >
> > or just:
> >
> > $!data.getMessage()
> >
> > which will quietly print out nothing if it evaluates to null.
> >
> > cheers,
> >
> > Paul Smith
> >
> > > -----Original Message-----
> > > From: Ryan Austin [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, 13 December 2002 3:25 PM
> > > To: Turbine Users List
> > > Subject: Re: $data not available in Default.vm in layouts 
> directory
> > >
> > >
> > > Yes, I have tried other methods and also populated data 
> with messages.
> > >
> > > if I add these lines,
> > >
> > > #if ($data.getMessage())
> > > {
> > >     $data.getMessage()
> > > }
> > >
> > > I get this exception,
> > >
> > > Horrible Exception: 
> org.apache.velocity.exception.ParseErrorException:
> > > Encountered "<EOF>" at line 26, column 1.
> > > Was expecting one of:
> > >     "(" ...
> > >     <RPAREN> ...
> > >     <ESCAPE_DIRECTIVE> ...
> > >     <SET_DIRECTIVE> ...
> > > rethrown as org.apache.turbine.util.TurbineException: 
> Error rendering
> > > Velocity template: layouts/Default.vm: Encountered 
> "<EOF>" at line 26,
> > > column 1.
> > > Was expecting one of:
> > >     "(" ...
> > > rethrown as org.apache.turbine.util.TurbineException: 
> Error rendering
> > > Velocity template: layouts/Default.vm: Error rendering
> > > Velocity template:
> > > layouts/Default.vm: Encountered "<EOF>" at line 26, column 1.
> > > Was expecting one of:
> > >     "(" ...
> > >     <RPAREN> ...
> > >     <ESCAPE_DIRECTIVE> ...
> > >     <SET_DIRECTIVE> ...
> > >     "\\\\" ...
> > >     "\\" ...
> > >     <TEXT> ...
> > >     <SINGLE_LINE_COMMENT> ...
> > >     "*#" ...
> > >     "*#" ...
> > >     <STRING_LITERAL> ...
> > >     <END> ...
> > >     "if" ...
> > >     "elseif" ...
> > >     <ELSE_DIRECTIVE> ...
> > >     "stop" ...
> > >     <NUMBER_LITERAL> ...
> > >     <WORD> ...
> > >     <IDENTIFIER> ...
> > >     <DOT> ...
> > >     "{" ...
> > >
> > >  at
> > > org.apache.turbine.services.velocity.TurbineVelocityService.re
> > > nderingError(T
> > > urbineVelocityService.java:392)
> > >  at
> > > org.apache.turbine.services.velocity.TurbineVelocityService.ha
> > > ndleRequest(Tu
> > > rbineVelocityService.java:252)
> > >  at
> > > org.apache.turbine.services.velocity.TurbineVelocity.handleReq
> > > uest(TurbineVe
> > > locity.java:109)
> > >  at
> > > org.apache.turbine.modules.layouts.VelocityECSLayout.doBuild(V
> > > elocityECSLayo
> > > ut.java:126)
> > >  at org.apache.turbine.modules.Layout.build(Layout.java:91)
> > >  at
> > > 
> org.apache.turbine.modules.LayoutLoader.exec(LayoutLoader.java:123)
> > >  at
> > > org.apache.turbine.modules.pages.DefaultPage.doBuild(DefaultPa
> > > ge.java:166)
> > >  at org.apache.turbine.modules.Page.build(Page.java:90)
> > >  at 
> org.apache.turbine.modules.PageLoader.exec(PageLoader.java:123)
> > >  at org.apache.turbine.Turbine.doGet(Turbine.java:447)
> > >  at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> > >  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > >  at
> > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
> > > er(Application
> > > FilterChain.java:247)
> > >  at
> > > org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
> > > cationFilterCh
> > > ain.java:193)
> > >  at
> > > org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
> > > rapperValve.ja
> > > va:255)
> > >  at
> > > org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
> > > ipeline.java:5
> > > 66)
> > >  at
> > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > > ine.java:472)
> > >  at
> > > 
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
> > >  at
> > > org.apache.catalina.core.StandardContextValve.invoke(StandardC
> > > ontextValve.ja
> > > va:225)
> > >  at
> > > org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
> > > ipeline.java:5
> > > 66)
> > >  at
> > > org.apache.catalina.authenticator.AuthenticatorBase.invoke(Aut
> > > henticatorBase
> > > .java:472)
> > >  at
> > > org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
> > > ipeline.java:5
> > > 64)
> > >  at
> > > org.apache.catalina.valves.CertificatesValve.invoke(Certificat
> > > esValve.java:2
> > > 46)
> > >  at
> > > org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
> > > ipeline.java:5
> > > 64)
> > >  at
> > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > > ine.java:472)
> > >  at
> > > 
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
> > >  at
> > > org.apache.catalina.core.StandardContext.invoke(StandardContex
> > > t.java:2252)
> > >  at
> > > org.apache.catalina.core.StandardHostValve.invoke(StandardHost
> > > Valve.java:164
> > > )
> > >  at
> > > org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
> > > ipeline.java:5
> > > 66)
> > >  at
> > > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValv
> > > e.java:446)
> > >  at
> > > org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
> > > ipeline.java:5
> > > 64)
> > >  at
> > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > > ine.java:472)
> > >  at
> > > 
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
> > >  at
> > > org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
> > > gineValve.java
> > > :163)
> > >  at
> > > org.apache.catalina.core.StandardPipeline.invokeNext(StandardP
> > > ipeline.java:5
> > > 66)
> > >  at
> > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > > ine.java:472)
> > >  at
> > > 
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
> > >  at
> > > org.apache.catalina.connector.http.HttpProcessor.process(HttpP
> > > rocessor.java:
> > > 875)
> > >  at
> > > org.apache.catalina.connector.http.HttpProcessor.run(HttpProce
> > > ssor.java:952)
> > >  at java.lang.Thread.run(Thread.java:536)
> > >
> > > ----- Original Message -----
> > > From: <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Thursday, December 12, 2002 8:17 PM
> > > Subject: RE: $data not available in Default.vm in layouts 
> directory
> > >
> > >
> > > > Have you populated the rundata object with any messages
> > > yet?   Have you
> > > > tried any of the other properties of RunData to see if they
> > > are all bad?
> > > >
> > > > Eric
> > > >
> > > > -----Original Message-----
> > > > From: Ryan Austin [mailto:[EMAIL PROTECTED]]
> > > > Sent: Thursday, December 12, 2002 11:18 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: $data not available in Default.vm in layouts directory
> > > >
> > > >
> > > > I am using version 2.1 and when I reference RunData in
> > > > the Default layout template, it doesn't do anything?
> > > >
> > > > For example,
> > > >
> > > > $data.getMessage()
> > > >
> > > > doesn't grab any messages, it just is displayed as is when
> > > the template is
> > > > expanded.
> > > >
> > > > Any ideas?
> > > >
> > > > Thanks,
> > > > Ryan
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to