[
https://issues.apache.org/jira/browse/WW-4145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13716335#comment-13716335
]
Lukasz Lenart commented on WW-4145:
-----------------------------------
But it doesn't work - or I'm missing something :\ Below is how I understand
does it work:
- define template (new folder under /template, ie. MyTheme)
- override tag (create a file named like existing one, ie. checkboxlist.ftl)
- define whatever you need in the new file
- define theme.properties with parent = xhtml (for example)
- S2 will look for files in /template/MyTheme/text.ftl, then under parent ->
/template/xhtml/text.ftl and so on.
- when S2 will find file, it will pass it to Freemarker to render and FM
replaces all $\{} with appropriate values ($\{parameters.theme} -> MyTheme}
- right now S2 lost control over inheritance as FM will try to include file:
/template/MyTheme/text.ftl which doesn't exist
So that code:
{code:xml}
<#include "/${parameters.templateDir}/${parameters.theme}/controlheader.ftl" />
<#include "/${parameters.templateDir}/simple/checkboxlist.ftl" />
<#include "/${parameters.templateDir}/xhtml/controlfooter.ftl" /><#nt/>
{code}
will be converted to:
{code:xml}
<#include "/template/MyTheme/controlheader.ftl" />
<#include "/template/simple/checkboxlist.ftl" />
<#include "/template/xhtml/controlfooter.ftl" /><#nt/>
{code}
which is rendered by FM.
I have been testing that with
https://svn.apache.org/repos/asf/struts/sandbox/trunk/struts2examples/themes/
> 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