You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Bill Burton <bi...@progress.com> on 2001/08/02 10:16:10 UTC

Handling unsupported tags in section?

Hello,

I've just started looking at Turbine (TDK 2.1) primarily as a framework
for supporting Velocity templates.  My intention is to use the Pull model
for many of our pages to eliminate the need for an associated Java class
for each page.

One of the issues I'm having converting one of our sites is the $page
context object doesn't have support for all the required <meta> tags we
require.  It doesn't seem to me the answer is to just add more and more
stuff to the Page object.

What I'd really like is the ability for each screen template to be a well
formed HTML page with <head> and <body> sections.  When the screen is
loaded, the contents <head> and </head> would be extracted and saved in
the context with a name like, $screen_head_placeholder.  The contents
between <body> and </body> would be set to $screen_placeholder as it is
now for the whole template.  Then in my layout template, I can just access
these variables from the context inserting the sections in the appropriate
place.

If anyone has already done something like this or has any suggestions on
how I could implement this scheme, I'd appreciate the feedback.

Thanks,
-Bill

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Handling unsupported tags in section?

Posted by John McNally <jm...@collab.net>.
The jsp service handles layouts and screens the way you are proposing. 
It is able to do so because jsp allows partial template rendering.  i
have not found a way to implement the idea using velocity, but in
turbine2.1 it is not necessary as the screen template will be rendered
before the layout and its results inserted into the correct place.  if
you use VelocityECSLayout, you can add anything you need to the <head>. 
Note use of ECS is deprecated.  We are looking for a solution in
Turbine3.0.

john mcnally

Bill Burton wrote:
> 
> Hello,
> 
> I've just started looking at Turbine (TDK 2.1) primarily as a framework
> for supporting Velocity templates.  My intention is to use the Pull model
> for many of our pages to eliminate the need for an associated Java class
> for each page.
> 
> One of the issues I'm having converting one of our sites is the $page
> context object doesn't have support for all the required <meta> tags we
> require.  It doesn't seem to me the answer is to just add more and more
> stuff to the Page object.
> 
> What I'd really like is the ability for each screen template to be a well
> formed HTML page with <head> and <body> sections.  When the screen is
> loaded, the contents <head> and </head> would be extracted and saved in
> the context with a name like, $screen_head_placeholder.  The contents
> between <body> and </body> would be set to $screen_placeholder as it is
> now for the whole template.  Then in my layout template, I can just access
> these variables from the context inserting the sections in the appropriate
> place.
> 
> If anyone has already done something like this or has any suggestions on
> how I could implement this scheme, I'd appreciate the feedback.
> 
> Thanks,
> -Bill
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Handling unsupported tags in section?

Posted by Bill Burton <bi...@progress.com>.
Hello,

I tried using the VelocityOnlyLayout.  However, it inserts the whole
screen template into the location of the layout template verbatim where
$screen_placeholder is specified.  This including the <head> section, meta
tags, etc.

It seems what I need to do is write a new version of VelocityOnlyLayout
which after getting the screen via ScreenLoader, parses the resulting
string into two strings, each being the contents between the <head>,
</head> and <body>, </body> tags respectively and then puts them into the
Context.  Then in my layout template I can specify where the head
information can go.

Also, I was thinking it would be nice if Velocity had a #setblock
directive so you could do something like:
    #setblock($screen_head_placeholder)
    <title>the title</title>
    <meta ... >
    #end.
which would result in the contents between #setblock and #end being put
into the Context as $screen_head_placeholder.  Well it turns out you can
do almost the same thing by using a macro:
    #macro(head_contents)
    <title>the title</title>
    <meta ... >
    #end
    ... rest of screen content ...
Then in the layout template, just specify #head_contents() where it should
go.  This isn't quite what I wanted but will do until I can write an
improved VelocityOnlyLayout class.

Thanks for the assistance,
-Bill

Jon Stevens wrote:
> 
> on 8/2/01 1:16 AM, "Bill Burton" <bi...@progress.com> wrote:
> 
> > Hello,
> >
> > I've just started looking at Turbine (TDK 2.1) primarily as a framework
> > for supporting Velocity templates.  My intention is to use the Pull model
> > for many of our pages to eliminate the need for an associated Java class
> > for each page.
> >
> > One of the issues I'm having converting one of our sites is the $page
> > context object doesn't have support for all the required <meta> tags we
> > require.  It doesn't seem to me the answer is to just add more and more
> > stuff to the Page object.
> >
> > What I'd really like is the ability for each screen template to be a well
> > formed HTML page with <head> and <body> sections.  When the screen is
> > loaded, the contents <head> and </head> would be extracted and saved in
> > the context with a name like, $screen_head_placeholder.  The contents
> > between <body> and </body> would be set to $screen_placeholder as it is
> > now for the whole template.  Then in my layout template, I can just access
> > these variables from the context inserting the sections in the appropriate
> > place.
> >
> > If anyone has already done something like this or has any suggestions on
> > how I could implement this scheme, I'd appreciate the feedback.
> >
> > Thanks,
> > -Bill
> 
> Use  VelocityOnlyLayout which allows you to simply put whatever you want
> into it.
> 
> -jon

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Handling unsupported tags in section?

Posted by Jon Stevens <jo...@latchkey.com>.
on 8/2/01 1:16 AM, "Bill Burton" <bi...@progress.com> wrote:

> Hello,
> 
> I've just started looking at Turbine (TDK 2.1) primarily as a framework
> for supporting Velocity templates.  My intention is to use the Pull model
> for many of our pages to eliminate the need for an associated Java class
> for each page.
> 
> One of the issues I'm having converting one of our sites is the $page
> context object doesn't have support for all the required <meta> tags we
> require.  It doesn't seem to me the answer is to just add more and more
> stuff to the Page object.
> 
> What I'd really like is the ability for each screen template to be a well
> formed HTML page with <head> and <body> sections.  When the screen is
> loaded, the contents <head> and </head> would be extracted and saved in
> the context with a name like, $screen_head_placeholder.  The contents
> between <body> and </body> would be set to $screen_placeholder as it is
> now for the whole template.  Then in my layout template, I can just access
> these variables from the context inserting the sections in the appropriate
> place.
> 
> If anyone has already done something like this or has any suggestions on
> how I could implement this scheme, I'd appreciate the feedback.
> 
> Thanks,
> -Bill

Use  VelocityOnlyLayout which allows you to simply put whatever you want
into it.

-jon


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org