Message Boards

Versioning for Structures, Template and ADT( Application Display Templates)

sree p, modified 3 Years ago.

Versioning for Structures, Template and ADT( Application Display Templates)

Junior Member Posts: 91 Join Date: 10/3/19 Recent Posts
Hello,We are using Liferay DXP , can you please let me know what we can do to maintain versioning for Structures, Template , Widget Templates and ADT( Application Display Templates) same as Web Content .
thumbnail
Christoph Rabel, modified 3 Years ago.

RE: Versioning for Structures, Template and ADT( Application Display Templa

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts
There is actually a history in the database for structures and templates, but there is no frontend for it. You could check the DDM* tables and you will find it there.
We do it differently. A few years ago, we used Webdav to sync the the structures/templates to the filesystem and put them into git.
https://devcon.dccs.at/ideas-for-template-export
Our next iteration was an extra rest api that allowed us to pull/push structures/templates.
Our current code does it differently again. Structures and templates are created manually, since creation and changes to structures are rare. But templates are in git and deployed. But the templates just contain a single line:
<#include "dccs-templates-bundle_SERVLET_CONTEXT_/global/application_display_template/templates/NewUsersTable.ftl" />
They load the template from our module with the include statement. It basically just needs the bundle name + _SERVLET_CONTEXT_ + the file path in the bundle to load it.
For fragments Liferay does better. I wished, the same feature, to simply implement a fragment processor, was available for templates too.
sree p, modified 3 Years ago.

RE: Versioning for Structures, Template and ADT( Application Display Templa

Junior Member Posts: 91 Join Date: 10/3/19 Recent Posts
Thanks Chris, I did not clear about your answer, could you please elaborate the details, I want versioning to Structures , Presentation templates and Widget Template, please let me know how can do that in Liferay DXP same as web content items.
thumbnail
Christoph Rabel, modified 3 Years ago.

RE: Versioning for Structures, Template and ADT( Application Display Templa

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts
Which details? I have mentioned several options and outlining them in detail would require me to write several pages.
Do you want to edit the templates in an Eclipse (or some other editor) and deploy them or do you want to edit them in the Liferay frontend and then download them and version them?
These are fundamentally different approaches, depending on your work.
sree p, modified 3 Years ago.

RE: Versioning for Structures, Template and ADT( Application Display Templa

Junior Member Posts: 91 Join Date: 10/3/19 Recent Posts
HI Chris, can you please let me how do i create/edit the templates through Liferay Dev Studio/Eclipse and deploy theme through DevOps process and test those templates  and also want to create/edit them in the Liferay frontend and then do version . finally let me know how to connect to webDAV
thumbnail
Christoph Rabel, modified 3 Years ago.

RE: Versioning for Structures, Template and ADT( Application Display Templa

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts
You can access the webdav service with https://yourserver/webdav/
I have published a little tool a few years ago that syncs structures and templates to the file system:
https://github.com/dccs-liferay/devcon/tree/master/WebdavSync
The tool should support the upload too, but I didn't use it for quite a while.

As I said, we currently do it the other way round.
a) Create a template or ADT in Liferay through the frontent.
b) Add a line like this:
&lt;#include "dccs-templates-bundle_SERVLET_CONTEXT_/global/application_display_template/templates/NewUsersTable.ftl" /&gt;

This loads a file "NewUsersTable.ftl" from a simple module dccs-templates-bundle.
c) Create a new module dccs-templates-bundle
d) Create a folder /global/application_display_template/templates  (or whatever you like, it just has to be the same as in the include statement)
e) Add NewUsersTable.ftl and write some code into it
f) deploy ...