[ 
https://issues.apache.org/jira/browse/LABS-241?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663808#action_12663808
 ] 

Simone Gianni commented on LABS-241:
------------------------------------

A good way to make nesting coudl be the following :
- Add a new series of methods for adding a template when laying out a zone
... this means that inclusion is performed at java level, as if a template was 
a producer
- When evaluating the included template, if a method "layoutXXX" is present in 
the main template, that one is called instead of the target template method
... this way the external template can "customize" the content of the included 
template
... Recursion prevention : it should not happen when that layout method is 
already on a "stack" of called layout methods
- A "main" can be passed to the included template
... thought not strictly needed for including "header" or "footer" templates, 
it will make possible to create "decoration" templates.

Anyway, the idea of "templates as producers" still is a good one, but would be 
a bigger refactoring, bringing more flexibility but with the cost of 
overlapping with producers compounding which is by far simpler to understand 
for the end user.

> [web] Templates nesting/includes
> --------------------------------
>
>                 Key: LABS-241
>                 URL: https://issues.apache.org/jira/browse/LABS-241
>             Project: Labs
>          Issue Type: New Feature
>          Components: Magma
>    Affects Versions: Current
>            Reporter: Simone Gianni
>            Assignee: Simone Gianni
>             Fix For: Future
>
>
> While it is possible to extend a template class with another template class, 
> and inherit/override as usual, this is not currently possible on an HTML 
> level.
> That means that a web site will have a TempateA.java and a TemplateA.html. 
> Then a TemplateB.java, extending TemplateA and simply overriding and 
> cutomizing stuff, but must have a TemplateB.html file (if needed) that must 
> redefine everything that was in TemplateA.html.
> It would be nice to have a TemplateB.html that simply "patches" TemplateA, 
> but unfortunately this is not so easy, because there is no known standard on 
> patching an HTML file. XSLT could be a way, but that would be rather an 
> extension than a new feature.
> Instead, this lack can be mitigated having a way to include a template in 
> another template. This way, common parts between TemplateA and TemplateB 
> could be refactored out in, say, FooterTemplate, HeaderTemplate and so on.
> We still need to investigate wether this kind of inclusion should be done in 
> the java class, using the current layout system, and/or in HTML directly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to