You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Charles N. Harvey III" <ch...@alloy.com> on 2002/06/05 23:40:38 UTC
super template
Ok, not really a "super template", but a template that calls all others.
The usual scenario is this:
<html>
<body>
#include( pageTop.html )
#parse ( navigation.vm )
<p>stuff...
...
...
...
</p>
#include ( pageBottom.html )
</body>
</html>
But I have to have those calls on every page of my site. So if I want to
add
another #include statement I have to change a lot of pages. What would be
the
best scenario is that every request gets the super template - page.vm:
<html>
<body>
#include( pageTop.html )
#parse ( navigation.vm )
#parse ( /path/to/particular/body.vm )
#include ( pageBottom.html )
</body>
</html>
And body.vm is:
<p>stuff...
...
...
...
</p>
I could swear hearing something about this being done by somebody. Any
ideas?
Because then I can make changes to page.vm and every page on the site feels
the effect.
Thanks for your insight(s).
Charlie
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: super template
Posted by Huy Do <hu...@tramada.com.au>.
You should look at how Turbine does it http://jakarta.apache.org/turbine.
They have split it up into Page, Layout, Screens etc. If I understand you
correctly, this is what you are trying to achieve.
Huy
> -----Original Message-----
> From: Charles N. Harvey III [mailto:charlieh@alloy.com]
> Sent: Thursday, 6 June 2002 7:41 AM
> To: Velocity Users List
> Subject: super template
>
>
> Ok, not really a "super template", but a template that calls all others.
>
> The usual scenario is this:
>
> <html>
> <body>
> #include( pageTop.html )
> #parse ( navigation.vm )
>
> <p>stuff...
> ...
> ...
> ...
> </p>
>
> #include ( pageBottom.html )
> </body>
> </html>
>
>
> But I have to have those calls on every page of my site. So if I want to
> add
> another #include statement I have to change a lot of pages. What would be
> the
> best scenario is that every request gets the super template - page.vm:
>
> <html>
> <body>
> #include( pageTop.html )
> #parse ( navigation.vm )
>
> #parse ( /path/to/particular/body.vm )
>
> #include ( pageBottom.html )
> </body>
> </html>
>
>
> And body.vm is:
> <p>stuff...
> ...
> ...
> ...
> </p>
>
>
> I could swear hearing something about this being done by somebody. Any
> ideas?
> Because then I can make changes to page.vm and every page on the
> site feels
> the effect.
>
> Thanks for your insight(s).
>
> Charlie
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: super template
Posted by "Charles N. Harvey III" <ch...@alloy.com>.
How 'bout if my getTemplate() always calls the same template - page.vm.
And I put the request string in the context.
String pageToGet = "/home/news/wednesday.vm";
context.put("middleofpage", pageToGet);
And in my page.vm I have
----------------------------------
#include ( top.html )
#parse ( navigation.vm )
#parse ( $middleofpage )
#include ( footer.html )
----------------------------------
Will that parse correctly at runtime? I am getting around to writing a
quick servlet to check this out, just thought I'd ask for opinions.
Charlie
> -----Original Message-----
> From: Charles N. Harvey III [mailto:charlieh@alloy.com]
> Sent: Wednesday, June 05, 2002 5:41 PM
> To: Velocity Users List
> Subject: super template
>
>
> Ok, not really a "super template", but a template that calls all others.
>
> The usual scenario is this:
>
> <html>
> <body>
> #include( pageTop.html )
> #parse ( navigation.vm )
>
> <p>stuff...
> ...
> ...
> ...
> </p>
>
> #include ( pageBottom.html )
> </body>
> </html>
>
>
> But I have to have those calls on every page of my site. So if I want to
> add
> another #include statement I have to change a lot of pages. What would be
> the
> best scenario is that every request gets the super template - page.vm:
>
> <html>
> <body>
> #include( pageTop.html )
> #parse ( navigation.vm )
>
> #parse ( /path/to/particular/body.vm )
>
> #include ( pageBottom.html )
> </body>
> </html>
>
>
> And body.vm is:
> <p>stuff...
> ...
> ...
> ...
> </p>
>
>
> I could swear hearing something about this being done by somebody. Any
> ideas?
> Because then I can make changes to page.vm and every page on the
> site feels
> the effect.
>
> Thanks for your insight(s).
>
> Charlie
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: super template
Posted by "Charles N. Harvey III" <ch...@alloy.com>.
Tim, Anthony, Huy:
Thanks. These were all great answers and I am well on my way.
I really can't say enough about this list - it really rocks.
Charlie
> -----Original Message-----
> From: Tim Colson [mailto:tcolson@cisco.com]
> Sent: Monday, June 10, 2002 6:22 PM
> To: 'Velocity Users List'
> Subject: RE: super template
>
>
> Charles -
>
> > Ok, not really a "super template", but a template that calls all
> others.
> > The usual scenario is this:
>
> Snip - descripes a "layout" page that is applied/wrapped around the main
> body content.
>
> > I could swear hearing something about this being done by
> > somebody. Any ideas?
>
> Righto - it has been done by several folks in different ways. ;-)
>
> My rather simple-minded solution was to subclass the VelocityViewServlet
> and perform what I call a "two-pass render".
>
> http://www.mail-archive.com/velocity-dev@jakarta.apache.org/msg05936.htm
> l
>
> Hope that helps,
> Tim
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: super template
Posted by Tim Colson <tc...@cisco.com>.
Charles -
> Ok, not really a "super template", but a template that calls all
others.
> The usual scenario is this:
Snip - descripes a "layout" page that is applied/wrapped around the main
body content.
> I could swear hearing something about this being done by
> somebody. Any ideas?
Righto - it has been done by several folks in different ways. ;-)
My rather simple-minded solution was to subclass the VelocityViewServlet
and perform what I call a "two-pass render".
http://www.mail-archive.com/velocity-dev@jakarta.apache.org/msg05936.htm
l
Hope that helps,
Tim
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: super template
Posted by Anthony Eden <ae...@signaturedomains.com>.
JPublish ( http://www.jpublish.org/ ) provides this functionality.
Sincerely,
Anthony Eden
> -----Original Message-----
> From: Charles N. Harvey III [mailto:charlieh@alloy.com]
> Sent: Wednesday, June 05, 2002 5:41 PM
> To: Velocity Users List
> Subject: super template
>
>
> Ok, not really a "super template", but a template that calls all others.
>
> The usual scenario is this:
>
> <html>
> <body>
> #include( pageTop.html )
> #parse ( navigation.vm )
>
> <p>stuff...
> ...
> ...
> ...
> </p>
>
> #include ( pageBottom.html )
> </body>
> </html>
>
>
> But I have to have those calls on every page of my site. So if I want to
> add
> another #include statement I have to change a lot of pages. What would be
> the
> best scenario is that every request gets the super template - page.vm:
>
> <html>
> <body>
> #include( pageTop.html )
> #parse ( navigation.vm )
>
> #parse ( /path/to/particular/body.vm )
>
> #include ( pageBottom.html )
> </body>
> </html>
>
>
> And body.vm is:
> <p>stuff...
> ...
> ...
> ...
> </p>
>
>
> I could swear hearing something about this being done by somebody. Any
> ideas?
> Because then I can make changes to page.vm and every page on the site feels
> the effect.
>
> Thanks for your insight(s).
>
> Charlie
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>