You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Lukasz Lenart <lu...@apache.org> on 2013/07/16 11:07:34 UTC

Theme support

Hi,

I have been digging into Theme support in S2 and have some doubts.
First of all to use a new theme globally (via struts.ui.theme
property), theme must implement all the tags - thus can be simple
solved by copping parent's files into new theme. It's because many
tags uses ${parameters.theme} which is passed directly to Freemarker
and we cannot control path resolution any more.

ie. /template/css_xhtml/text.ftl

<#include "/${parameters.templateDir}/${parameters.theme}/controlheader.ftl" />
<#include "/${parameters.templateDir}/simple/text.ftl" />
<#include "/${parameters.templateDir}/css_xhtml/controlfooter.ftl" />

and when I want to create a new theme called myTheme, with new version
of just one tag (checkboxlist.ftl), but I will be using also text.ftl
(without modification), Freemarker will be try to load
/template/myTheme/controlheader.ftl (because of <#include/>
statement), but when the text.ftl will be changed to:

<#include "/${parameters.templateDir}/css_xhtml/controlheader.ftl" />
<#include "/${parameters.templateDir}/simple/text.ftl" />
<#include "/${parameters.templateDir}/css_xhtml/controlfooter.ftl" />

there be no problem with extending and overriding just one tag.

Does anyone know what was the idea to use ${parameters.theme} instead
of hardcoded path?

For curiosity, text.ftl contains <#--include
"/${parameters.templateDir}/css_xhtml/controlheader.ftl" / --> (as you
can see, it is commented out)


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Theme support

Posted by Lukasz Lenart <lu...@apache.org>.
If there be no objections, I will change all ${parameters.theme} to
hardcoded value - but I don't know how thus will affect users :\

2013/7/16 Lukasz Lenart <lu...@apache.org>:
> Hi,
>
> I have been digging into Theme support in S2 and have some doubts.
> First of all to use a new theme globally (via struts.ui.theme
> property), theme must implement all the tags - thus can be simple
> solved by copping parent's files into new theme. It's because many
> tags uses ${parameters.theme} which is passed directly to Freemarker
> and we cannot control path resolution any more.
>
> ie. /template/css_xhtml/text.ftl
>
> <#include "/${parameters.templateDir}/${parameters.theme}/controlheader.ftl" />
> <#include "/${parameters.templateDir}/simple/text.ftl" />
> <#include "/${parameters.templateDir}/css_xhtml/controlfooter.ftl" />
>
> and when I want to create a new theme called myTheme, with new version
> of just one tag (checkboxlist.ftl), but I will be using also text.ftl
> (without modification), Freemarker will be try to load
> /template/myTheme/controlheader.ftl (because of <#include/>
> statement), but when the text.ftl will be changed to:
>
> <#include "/${parameters.templateDir}/css_xhtml/controlheader.ftl" />
> <#include "/${parameters.templateDir}/simple/text.ftl" />
> <#include "/${parameters.templateDir}/css_xhtml/controlfooter.ftl" />
>
> there be no problem with extending and overriding just one tag.
>
> Does anyone know what was the idea to use ${parameters.theme} instead
> of hardcoded path?
>
> For curiosity, text.ftl contains <#--include
> "/${parameters.templateDir}/css_xhtml/controlheader.ftl" / --> (as you
> can see, it is commented out)
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org