struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jasper Rosenberg (JIRA)" <>
Subject [jira] [Commented] (WW-4145) file.ftl in xhtml theme directly references xhtml controlfooter.ftl
Date Tue, 23 Jul 2013 12:32:48 GMT


Jasper Rosenberg commented on WW-4145:

Ah, maybe this only worked for me because I needed to override the controlheader.ftl and controlfooter.ftl
files (which is why I reported this issue in the first place).  

It seems to me that the real problem is the last step: "right now S2 lost control over inheritance
as FM will try to include file: /template/MyTheme/text.ftl which doesn't exist"

What if instead of passing in parameters.theme to the rendering, we pass in parameters.themeHierarchy
which is in this case ["MyTheme", "xhtml", "simple"]

We them have a macro which includes the first matching template found in a theme.  Something

<#macro includeThemeTemplate templateName>
  <#list parameters.themeHierarchy as theme>
      <#include "/${parameters.templateDir}/${theme}/${templateName}" />
  <#-- Cause an exception intentionally which will have the top most theme -->
  <#include "/${parameters.templateDir}/${parameters.themeHierarchy[0]}/${templateName}"

So the new code would look like:
<@includeThemeTemplate "controlheader.ftl"/>
<#include "/${parameters.templateDir}/simple/checkboxlist.ftl" />
<@includeThemeTemplate "controlfooter.ftl"/>

This is just me writing Freemarker in place, so apologies if I have typos.

> file.ftl in xhtml theme directly references xhtml controlfooter.ftl
> -------------------------------------------------------------------
>                 Key: WW-4145
>                 URL:
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Other
>    Affects Versions:
>            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:

View raw message