Skip to content

Instantly share code, notes, and snippets.

@gonzalezalo
gonzalezalo / using-templates-in-adt.ftl
Last active June 29, 2022 11:01
Using Liferay WebContent Template from ADT - Liferay 7
<#-- Liferay info on templates: https://dev.liferay.com/discover/portal/-/knowledge_base/7-0/designing-uniform-content -->
<#-- There is more than just a way of doing this: -->
<#-- Option 1 -->
<#assign journalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService")>
<#if entries?has_content>
<#list entries as curEntry>
<#assign article = curEntry.getAssetRenderer().getArticle() />
<#assign model = objectUtil("com.liferay.portal.kernel.portlet.PortletRequestModel", renderRequest, renderResponse) />
@gonzalezalo
gonzalezalo / get-webcontent-data.ftl
Created July 24, 2017 22:15
Web Content Data from template - Liferay 7
<#-- We have access to certain variables within a template (freemarker) -->
<#assign articleId = .vars['reserved-article-id'].data />
@gonzalezalo
gonzalezalo / Liferay-7-bookmarks.html
Created July 25, 2017 17:49
Liferay 7 Reference Links
<html>
<head>
<title>Liferay 7 bookmarks</title>
</head>
<body>
<a href="https://docs.liferay.com/portal/7.0-ga3/javadocs/portal-kernel/allclasses-noframe.html">Liferay 7 Javadoc</a>
</body>
</html>
@gonzalezalo
gonzalezalo / look-and-feel-color-schemes.xml
Last active July 28, 2017 18:08
Theme Look and Feel Configuration in Liferay 7
<!-- In the file named liferay-look-and-feel.xml
inside a theme we can define different color schemes -->
<look-and-feel>
<compatibility>
<version>7.0.0+</version>
</compatibility>
<theme id="theme-generator-test" name="Theme Generator Test">
<template-extension>ftl</template-extension>
@gonzalezalo
gonzalezalo / accessing-content-in-template.ftl
Last active June 29, 2022 09:40
How to access a Structured Web Content from Template Liferay 7
<#--
There are several ways of accesing the data stored in a structured web content,
it can be accesible by name, if the field is a main level item,
it can be a repetible content and so we have to access it's siblings,
and it can be a nested field and we have to access it through the parent.
-->
<#-- Structure Example Source (reduced and simplified)
I have deleted a lot of lines to make a Proof of Concept