struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <lukaszlen...@apache.org>
Subject Re: Cascading Nature of Templates and Themes
Date Tue, 05 May 2015 06:06:07 GMT
2015-05-05 7:19 GMT+02:00 Zoran Avtarovski <zoran@sparecreative.com>:
> I spoke too soon.
>
> I just replaced all instances of parameters.theme with
> parameters.expandTheme.
>
> I had copied all the missing simple templates into my mobile template

don't do it, Struts will find them. Just override those templates which you need

> directory as a work-around. When I deleted optgroup.ftl from the mobile
> template directory I get the following error:
>
> ERROR [ajp-nio-8009-exec-2] - Template processing error: "Error reading
> included file template/~~~mobile/optgroup.ftl"
>
> Error reading included file template/~~~mobile/optgroup.ftl
> The problematic instruction:
> ----------
> ==> include
> "/${parameters.templateDir}/${parameters.expandTheme}/optgroup.ftl" [on
> line 118, column 1 in template/simple/select.ftl]
>  in include "/${parameters.templateDir}/simple/select.ftl" [on line 25,
> column 1 in template/mobile/select.ftl]
> ----------
>
> Java backtrace for programmers:
> ----------
> freemarker.template.TemplateException: Error reading included file
> template/~~~mobile/optgroup.ftl
> .
> .
> .
> Caused by: java.io.FileNotFoundException: Template
> template/~~~mobile/optgroup.ftl not found.
>
>
> What I don’t understand I why the template manager doesn’t try to load
> optgroup.ftl from the simple template?

Maybe because of hardcoded "simple" - and it happens that not all
templates were adjusted to be "expandTheme" friendly ;)

>
> The mobile select.ftl template is simply:
>
> <#include
> "/${parameters.templateDir}/${parameters.expandTheme}/controlheader.ftl" />
> <#include "/${parameters.templateDir}/simple/select.ftl" />

You shouldn't hardcode "simple" here, use "expandTheme" to tell Struts
to check your theme first and than parent theme.

> <#include
> "/${parameters.templateDir}/${parameters.expandTheme}/controlfooter.ftl" />


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

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


Mime
View raw message