"Quinton McCombs" <[EMAIL PROTECTED]> wrote:

>The VelocityECSLayout is deprecated in T2.3.

This was news to me.  I totally understand why using ECS is not desirable for 
performance reasons here, but we are losing convenience to the user.  I have an idea 
to mitigate that however.

I had added a hack^H^H^H^Hfeature to my customized Layout to enable layouts to be 
embedded within other layouts.  This way you can have a standard layout containing 
just the basic HTML HEAD and BODY tag stuff, and then reuse that layout in other 
layouts.  

The way to do it is for the layout template itself to change the layoutTemplate in the 
TemplateInfo.  When the Layout class is done rendering the template using Velocity, it 
checks if the layoutTemplate name was changed, and if so, it sets the 
$screen_placeholder to the original layout content and then renders the new layout 
template.  Repeat as necessary.  The explanation is not very clear - here's the basic 
code:

    /*
     * Grab the layout template set in the TemplatePage.
     */
    String templateName = data.getTemplateInfo().getLayoutTemplate();

    /*
     * Finally, render the layout template.
     */
    String layoutContent = TurbineVelocity.handleRequest(
        context, "layouts" + templateName);

    // If the template itself changes the layoutTemplate, then it wants to
    // be embedded inside it.  This allows for any level of nesting, so beware
    // of infinite recursion.
    while (! templateName.equals(data.getTemplateInfo().getLayoutTemplate()))
    {
      templateName = data.getTemplateInfo().getLayoutTemplate();

      context.put("screen_placeholder", layoutContent);

      layoutContent = TurbineVelocity.handleRequest(
        context, "layouts" + templateName);
    }

Note that the embedding does not involve looking up the Layout class for the template 
that is being embedded in.  This is only for reusing content.

Does this idea appeal to anyone for general use in Turbine?

On a related note, I think it would make sense for "navigations" to be available 
within the screens.  This would make it much easier to create widget-like templates 
with smart functionality that can be reused throughout the site.  It would be akin to 
portlets in a sense.

- Chris


__________________________________________________________________
The NEW Netscape 7.0 browser is now available. Upgrade now! 
http://channels.netscape.com/ns/browsers/download.jsp 

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

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

Reply via email to