velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <>
Subject Re: Templates in VelocityLayoutServlet
Date Thu, 10 Jan 2008 00:29:25 GMT
On Jan 9, 2008 3:04 PM, Michael Yartsev <> wrote:
> > I don't understand what you are trying to accomplish here.  What
> > layout template are you using?  Which template below is your layout
> > and which is your $screen_content?
> >
> > It seems like you are using the layout servlet very strangely, trying
> > to do your own layout system in addition to the built in one.  It's a
> > bit confusing, so i'm not sure how to help you.
> Using it strangely? How so? (I used this page as a reference:
> According to what is written there, I created my own "Default" template.
> > I am creating a website using VLS and part of my template is
> > > /******************************************************
> > >             <div id="content">
> > >                 #parse($mainContent)
> > >             </div>
> > > ******************************************************/

ok, then this is your layout template.  that answers one question.

> Then, other ".vm" pages make use of that template.

well, the layout servlet will automatically load the "main content"
template, process it and insert it into the context as
$screen_content.  If your layout does not use the $screen_content
reference, then you are definitely using things strangely. :)  All the
example layouts in both the docs and example apps use $screen_content.
 None of them do this #parse( $mainContent ) thing, because none of
them need to.  My guess is that since the layout servlet is
automatically processing test.vm (dealing with your first stage here,
the others are really weird and wrong), then using that same context
(which now has $mainContent = 'test.vm') to process the layout
template, the layout template then pointlessly re-processes test.vm
via the call to #parse( $mainContent ) thus causing the duplicate
processing.  Replace #parse( $mainContent ) with $screen_content and
try again.

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

View raw message