struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jasper Rosenberg (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (WW-4145) file.ftl in xhtml theme directly references xhtml controlfooter.ftl
Date Tue, 30 Jul 2013 13:05:49 GMT

    [ https://issues.apache.org/jira/browse/WW-4145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13723829#comment-13723829
] 

Jasper Rosenberg edited comment on WW-4145 at 7/30/13 1:05 PM:
---------------------------------------------------------------

My Freemarker template implementation is definitely not going to be great, particularly because
it is uncached.

A better option might be to have a custom TemplateLoader at the top of the Configuration loader
stack that was theme aware.  That way it would naturally leverage the Freemarker caching layer.
 This is actually how we do template swapping in Freemarker for the A/B testing framework
I built years ago.

So we could have the include look like:
{code}
<#include "/${parameters.templateDir}/_theme_/controlfooter.ftl" /><#nt/>
{code}

Then our template loader could iterate through the theme hierarchy, replacing "\_theme\_"
with each name in turn, and call the rest of the stack on each version until it got a hit
which it would return.

I will try to write an implementation later today. I have just gotten back from vacation,
so I have to do some housekeeping first.
                
      was (Author: perfnorm):
    My Freemarker template implementation is definitely not going to be great, particularly
because it is uncached.

A better option might be to have a custom TemplateLoader at the top of the Configuration loader
stack that was theme aware.  That way it would naturally leverage the Freemarker caching layer.
 This is actually how we do template swapping in Freemarker for the A/B testing framework
I built years ago.

So we could have the include look like:
{code}
<#include "/${parameters.templateDir}/_theme_/controlfooter.ftl" /><#nt/>
{code}

Then our template loader could iterate through the theme hierarchy, replacing "_theme_" with
each name in turn, and call the rest of the stack on each version until it got a hit which
it would return.

I will try to write an implementation later today. I have just gotten back from vacation,
so I have to do some housekeeping first.
                  
> file.ftl in xhtml theme directly references xhtml controlfooter.ftl
> -------------------------------------------------------------------
>
>                 Key: WW-4145
>                 URL: https://issues.apache.org/jira/browse/WW-4145
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: 2.3.15.1
>            Reporter: Jasper Rosenberg
>            Assignee: Lukasz Lenart
>              Labels: freemarker, tags, xhtml
>             Fix For: 2.3.16
>
>
> Should use $\{parameters.theme} instead so can be used in theme extension.
> {code}
> <#include "/${parameters.templateDir}/${parameters.theme}/controlheader.ftl" />
> <#include "/${parameters.templateDir}/simple/file.ftl" />
> <#include "/${parameters.templateDir}/${parameters.theme}/controlfooter.ftl" />
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message