One customer has raised such question "Currently all our dialog templates we have similar code repeated over and over. For example we have added a wysiwyg field in all our template for which we have written same groovy code in all our dialog templates. Is it possible to externalize the code in a separate groovy template and refer it in all the dialog templates so that we can centrally change our dialog templates if needed." We've got the answer from eXo. ********************************************************************************* To include groovy snippets in the dialog template you can use : _ctx.include(TemplatePath); To get the path of the templae : import org.exoplatform.services.cms.templates.TemplateService; public String getTemplatePath(boolean isDialog, String nodeTypeName, String templateName) throws Exception { TemplateService tempService = uicomponent.getApplicationComponent(TemplateService.class); String path = tempService.getTemplatePath(isDialog, nodeTypeName, templateName) ; return path; } For example Example 1 : to embed the template of vote & comment for view template <div><% _ctx.include(uicomponent.getViewTemplate("mix:votable", "view1")); %></div> <div><% _ctx.include(uicomponent.getViewTemplate("exo:comments", "view1")); %></div> Example 2 : to embed the dialog template of exo:podcast for an other dialog template <% import org.exoplatform.services.cms.templates.TemplateService; TemplateService tempService = uicomponent.getApplicationComponent(TemplateService.class); String path = tempService.getTemplatePath(true, "exo:podcast", "dialog1") ; %> <% _ctx.include(path); %> ********************************************************************************* Can we add this info to the developer guide so that the other customers could benefit from it?
TRIAGE INFORMATION Relevance: EPP 5.2 and EPP 6 Task: Include the information provided by Gary in the Developer Guide for both versions. Add as a new section to the Portal Development section, under the heading "Groovy" http://documentation-devel.engineering.redhat.com/docs/en-US/JBoss_Enterprise_Portal_Platform/5.2/html-single/Developer_Guide/index.html#sid-8094155 Ensure you have access to: http://svn.jboss.org/repos/gatein/epp/docs/branches/5.2 and http://svn.jboss.org/repos/gatein/epp/docs/branches/6.0/ to make changes to these guides.
Release Note required.
The final fix is a bit different than what was proposed. The info has been added to the Site Publisher User Guide [1]. This is because the information is specific to Site Publisher. The info has been put generally as embedding of templates within one another rather than just about embedding of Groovy snippers. This is because the Groovy embedding is just one particular use case and the embedding itself had not been described anywhere in the docs. The info has been added only to EPP 5.2 docs. It was not included in JPP6 docs as JPP6 will not be shipped with the Site Publisher extension. [1] http://documentation-devel.engineering.redhat.com/docs/en-US/JBoss_Enterprise_Portal_Platform/5.2/html/Site_Publisher_User_Guide/sect-User_Guide-Content_Presentation_Manager-Manage_a_Template-Embedding.html