At 18:51 2001-6-26 -0400, you wrote:
>On 6/26/01 6:37 PM, "Xun Liu" <[EMAIL PROTECTED]> wrote:
>
> > At 18:01 2001-6-26 -0400, you wrote:
> >> On 6/26/01 5:07 PM, "Xun Liu" <[EMAIL PROTECTED]> wrote:
> >>
> >>> Not exactly. Different users will share the same templates, but different
> >>> layout and
> >>> look/feel.
> >>
> >> If the requirement is only to change the layout then why are you
> >> making calls to setScreenTemplate?
> >
> >
> > Here is an example:
> >
> > An screen class has the following code in the doBuildTemplate() method:
>
>So before this block of code you have already set the layout template?
>If so then a work around would be to do the following:
>
>// Save the layout template before setScreenTemplate
>// clobbers it.
>String layout = data.getLayoutTemplate();
>
> > If (the user is under 21) {
> >        data.setScreenTemplate("NoDrinking.vm")
> > }
> > else {
> >        data.setScreenTemplate("Drinking.vm")
> > }
>
>// Restore the layout template
>data.setLayoutTemplate(layout);
>
> > As you pointed out, after setScreenTemplate is executed the layout template
> > is also changed.
> >
> > However the users want the screen templates ("NoDrinking.vm",
> > "Drinking.vm", etc) to be
> > displayed in their preferred layout templates.
>
>Maybe we could change the behavior of setScreenTemplate() so
>that it optionally looked for a matching layout template or
>maybe we could make another method, say, setScreenTemplateXXX()
>that looked up the layout and the original method wouldn't.
>I'll think about it for a bit. But the work around should do
>the trick if it's your layout template that's getting
>clobbered by setScreenTemplate().
>

Thanks.

It seems to me that Turbine looks for layout template based on the assumption
that different screen templates will have different layout templates. (That 
may
explain why setScreenTemplate() actually changes the layout template)

So, according to way that Turbine looks for templates, if several screen 
templates
use the same one layout template, they should be grouped together into a 
directory
and the layout template should be put into a corresponding layout directory.

The drawback of this mechanism is that if a web site use more than one layout
templates, the screen templates will have to be grouped not according to 
the business
logic but to the Turbine's logic.

Or, the web site may want to decide which layout template to use at 
runtime, and after
that, save and restore the layout template every time the 
setScreenTemplate() is called.

Neither is beautiful. I'm expecting Turbine will have a better way to 
handle that.




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

Reply via email to