Listado de variables disponibles en Freemarker
Con ámbito global, theme y CMS
Este es el listado de variables que podemos usar en las plantillas de freemarker en Liferay 7.1. El ámbito de aplicación de la variable puede ser:
- Global: Se puede usar en plantillas freemarker de themes (temas de apariencia), ADT (application display template o plantillas de interfaz de la aplicación) y CMS templates (plantillas)
- Themes: Solo en las plantillas freemarker de los themes (temas de apariencia)
- CMS: Solo en las plantillas del CMS
Los enlaces a la documentación y los ejemplos los voy poniendo poco a poco. Si echas en falta alguna variable, añade por favor un comentario abajo del post :)
Listado de variables de freemarker
| Nombre de la variable | Documentación | Alcance |
|---|---|---|
| accountPermission | com.liferay.portal.kernel.service.permission.AccountPermission | GLOBAL |
| arrayUtil | com.liferay.portal.kernel.util.ArrayUtil_IW | GLOBAL |
| auditMessageFactoryUtil | com.liferay.portal.kernel.audit.AuditMessageFactory | GLOBAL |
| auditRouterUtil | com.liferay.portal.kernel.audit.AuditRouter | GLOBAL |
| bodyCssClass | String | GLOBAL |
| body_bottom_include | String | THEME |
| bottom_ext_include | String | THEME |
| bottom_include | String | THEME |
| browserSniffer | com.liferay.portal.kernel.servlet.BrowserSniffer | GLOBAL |
| calendarFactory | com.liferay.portal.kernel.util.CalendarFactory | GLOBAL |
| colorScheme | com.liferay.portal.kernel.model.ColorScheme | GLOBAL |
| commonPermission | com.liferay.portal.kernel.service.permission.CommonPermission | GLOBAL |
| company | com.liferay.portal.kernel.model.Company | GLOBAL |
| company_id | String | THEME |
| company_logo | String | THEME |
| company_logo_height | String | THEME |
| company_logo_width | String | THEME |
| company_name | String | THEME |
| company_name | String | THEME |
| company_url | String | THEME |
| community_default_private_url | String | THEME |
| community_default_public_url | String | THEME |
| community_default_url | String | THEME |
| community_name | String | THEME |
| content_include | String | THEME |
| control_panel_text | String | THEME |
| control_panel_url | String | THEME |
| css_folder | String | THEME |
| css_main_file | String | THEME |
| current_time | String | THEME |
| date | String | THEME |
| dateFormatFactory | com.liferay.portal.kernel.util.FastDateFormatFactory | GLOBAL |
| dateFormats | com.liferay.portal.kernel.util.FastDateFormatFactory (Es el mismo objeto que la variable anterior) | GLOBAL |
| dateUtil | com.liferay.portal.kernel.util.DateUtil_IW | GLOBAL |
| dir_include | String | THEME |
| enumUtil | freemarker.template.TemplateHashModel | GLOBAL |
| expandoColumnLocalService | com.liferay.expando.kernel.service.ExpandoColumnLocalService | GLOBAL |
| expandoRowLocalService | com.liferay.expando.kernel.service.ExpandoRowLocalService | GLOBAL |
| expandoTableLocalService | com.liferay.expando.kernel.service.ExpandoTableLocalService | GLOBAL |
| expandoValueLocalService | com.liferay.expando.kernel.service.ExpandoValueLocalService | GLOBAL |
| freeMarkerPortletPreferences | com.liferay.portal.template.TemplatePortletPreferences | GLOBAL |
| fullCssPath | String - Path a los css del theme | GLOBAL |
| fullTemplatesPath | String - Path a los templates del theme | GLOBAL |
| full_css_path | String | THEME |
| full_templates_path | String | THEME |
| getterUtil | com.liferay.portal.kernel.util.GetterUtil_IW | GLOBAL |
| group_id | long | THEME |
| groupPermission | com.liferay.portal.kernel.service.permission.GroupPermission | GLOBAL |
| has_navigation | String | THEME |
| home_text | String | THEME |
| home_url | String | THEME |
| htmlUtil | com.liferay.portal.kernel.util.Html | GLOBAL |
| httpUtil | com.liferay.portal.kernel.util.Http | GLOBAL |
| images_folder | String | THEME |
| imageToken | com.liferay.portal.kernel.webserver.WebServerServletToken | GLOBAL |
| imageToolUtil | com.liferay.portal.kernel.image.ImageTool | GLOBAL |
| init | String - Path al fichero init.ftl del theme | GLOBAL |
| is_default_user | boolean | THEME |
| is_female | boolean | THEME |
| is_first_child | String | THEME |
| is_first_parent | String | THEME |
| is_freeform | String | THEME |
| is_guest_group | String | THEME |
| is_login_redirect_required | boolean | THEME |
| is_male | boolean | THEME |
| is_maximized | String | THEME |
| is_portlet_page | String | THEME |
| is_setup_complete | boolean | THEME |
| is_signed_in | boolean | THEME |
| javascript_folder | String | THEME |
| js_main_file | String | THEME |
| jsonFactoryUtil | com.liferay.portal.kernel.json.JSONFactory | GLOBAL |
| language | String - El código del idioma del portal | THEME |
| languageUtil | com.liferay.portal.kernel.language.Language | GLOBAL |
| language_id | String - El código del idioma del usuario | THEME |
| layout | com.liferay.portal.kernel.model.layout | GLOBAL |
| layoutPermission | com.liferay.portal.kernel.service.permission.LayoutPermission | GLOBAL |
| layoutSet | Equivalente a layout.getLayoutSet() | THEME |
| layoutTypePortlet | com.liferay.portal.kernel.model.LayoutTypePortlet | GLOBAL |
| layouts | List< com.liferay.portal.kernel.model.Layout> | GLOBAL |
| liferay_toggle_controls | String - css class para indicar si se muestran los controles | THEME |
| locale | java.util.Locale | GLOBAL |
| localeUtil | com.liferay.portal.kernel.util.LocaleUtil | GLOBAL |
| locationPermission | com.liferay.portal.kernel.service.permission.OrganizationPermission | GLOBAL |
| logo_css_class | String | THEME |
| logo_description | String | THEME |
| my_account_text | String | THEME |
| my_account_url | String | THEME |
| my_places_text | String | THEME |
| my_sites_text | String | THEME |
| navItems | List< com.liferay.portal.kernel.theme.NavItem> | GLOBAL |
| nav_css_class | String | THEME |
| nav_items | String | THEME |
| objectUtil | freemarker.template.TemplateMethodModelEx (inicialmente deshabilitada) | GLOBAL |
| organizationPermission | com.liferay.portal.kernel.service.permission.OrganizationPermission (tiene el mismo valor que la variable locationPermission) | GLOBAL |
| page | String | THEME |
| page_group | com.liferay.portal.kernel.model.Group | THEME |
| page_javascript | String | THEME |
| page_javascript1 | String (no se usa) | THEME |
| page_javascript2 | String (no se usa) | THEME |
| page_javascript3 | String (no se usa) | THEME |
| paramUtil | com.liferay.portal.kernel.util.ParamUtil_IW | GLOBAL |
| passwordPolicyPermission | com.liferay.portal.kernel.service.permission.PasswordPolicyPermission | GLOBAL |
| permissionChecker | com.liferay.portal.kernel.security.permission.PermissionChecker | GLOBAL |
| plid | long - Valor de layout.getPlid() | GLOBAL |
| portal | com.liferay.portal.kernel.util.Portal | GLOBAL |
| portalPermission | com.liferay.portal.kernel.service.permission.PortalPermission | GLOBAL |
| portalUtil | com.liferay.portal.kernel.util.Portal ¿mismo valor que portal? | GLOBAL |
| portletConfig | com.liferay.portal.kernel.portlet.LiferayPortletConfig | GLOBAL |
| portletDisplay | com.liferay.portal.kernel.theme.PortletDisplay | GLOBAL |
| portlet_display | Equivalente a portletDisplay | THEME |
| portletGroupId | long | GLOBAL |
| portletModeFactory | com.liferay.portal.kernel.portlet.PortletModeFactory_IW | GLOBAL |
| portletPermission | com.liferay.portal.kernel.service.permission.PortletPermission | GLOBAL |
| portletProviderAction | Es un Map<String, Portletprovider.Action> | GLOBAL |
| portletRequestModelFactory | com.liferay.portal.kernel.portlet.PortletRequestModelFactory | GLOBAL |
| portletURLFactory | com.liferay.portal.kernel.portlet.PortletURLFactory | GLOBAL |
| prefsPropsUtil | com.liferay.portal.kernel.util.PrefsProps | GLOBAL |
| propsUtil | com.liferay.portal.kernel.util.Props | GLOBAL |
| randomizer | com.liferay.portal.kernel.util.Randomizer | GLOBAL |
| realUser | com.liferay.portal.kernel.model.User | GLOBAL |
| renderRequest | com.liferay.portal.kernel.portlet.LiferayRenderRequest | GLOBAL |
| renderResponse | com.liferay.portal.kernel.portlet.LiferayRenderResponse | GLOBAL |
| request | com.liferay.portal.kernel.servlet.DynamicServletRequest | GLOBAL |
| reserved-article-asset-tag-names | String | CMS |
| reserved-article-author-comments | String | CMS |
| reserved-article-author-email-address | String | CMS |
| reserved-article-author-id | String | CMS |
| reserved-article-author-job-title | String | CMS |
| reserved-article-author-location | String | CMS |
| reserved-article-author-name | String | CMS |
| reserved-article-author-organization | String | CMS |
| reserved-article-create-date | java.util.Date | CMS |
| reserved-article-description | String | CMS |
| reserved-article-display-date | java.util.Date | CMS |
| reserved-article-id | String | CMS |
| reserved-article-modified-date | java.util.Date | CMS |
| reserved-article-small-image-url | String | CMS |
| reserved-article-title | String | CMS |
| reserved-article-type | String | CMS |
| reserved-article-url-title | String | CMS |
| reserved-article-version | String | CMS |
| rolePermission | com.liferay.portal.kernel.service.permission.RolePermission | GLOBAL |
| root_css_class | String - Equivalente a languageUtil.get(locale, "lang.dir") | THEME |
| saxReaderUtil | com.liferay.portal.kernel.xml.SAXReader | GLOBAL |
| scopeGroupId | long - Valor de themeDisplay.getScopeGroupId() | GLOBAL |
| selectable | String | THEME |
| serviceLocator | com.liferay.portal.template.ServiceLocator (inicialmente inhabilitado) | GLOBAL |
| sessionClicks | com.liferay.portal.kernel.util.SessionClicks_IW | GLOBAL |
| show_control_panel | String | THEME |
| show_home | String | THEME |
| show_my_account | String | THEME |
| show_my_places | String | THEME |
| show_my_sites | String | THEME |
| show_sign_in | String | THEME |
| show_sign_out | String | THEME |
| show_site_name | String | THEME |
| show_site_name_default | String | THEME |
| show_site_name_supported | String | THEME |
| show_staging | boolean | THEME |
| show_toggle_controls | boolean | THEME |
| sign_in_text | String | THEME |
| sign_in_url | String | THEME |
| sign_out_text | String | THEME |
| sign_out_url | String | THEME |
| site_default_private_url | String | THEME |
| site_default_public_url | String | THEME |
| site_default_url | String | THEME |
| site_logo | String | THEME |
| site_logo_height | String | THEME |
| site_logo_width | String | THEME |
| site_name | String | THEME |
| site_type | String | THEME |
| staticFieldGetter | com.liferay.portal.kernel.util.StaticFieldGetter | GLOBAL |
| staticUtil | freemarker.template.TemplateHashModel (inicialmente deshabilitada) | GLOBAL |
| stringUtil | com.liferay.portal.kernel.util.StringUtil_IW | GLOBAL |
| templates_folder | String | THEME |
| theme | com.liferay.portal.kernel.model.Theme | GLOBAL |
| themeDisplay | com.liferay.portal.kernel.theme.ThemeDisplay | GLOBAL |
| themeDisplayModel | com.liferay.portal.kernel.portlet.ThemeDisplayModel | GLOBAL |
| theme_display | com.liferay.portal.kernel.theme.ThemeDisplay | THEME |
| theme_settings | String - Equivalente a themeDisplay.getThemeSettings() | THEME |
| theme_timestamp | long - Equivalente a themeDisplay.getTheme().getTimestamp() | THEME |
| the_title | String | THEME |
| the_year | String | THEME |
| timeZone | java.util.TimeZone | GLOBAL |
| timeZoneId | String | THEME |
| timeZoneUtil | com.liferay.portal.kernel.util.TimeZoneUtil_IW | GLOBAL |
| top_head_include | String | THEME |
| top_messages_include | String | THEME |
| typeSettingsProperties | String | THEME |
| unicodeFormatter | com.liferay.portal.kernel.util.UnicodeFormatter_IW | GLOBAL |
| unicodeLanguageUtil | com.liferay.portal.kernel.language.UnicodeLanguage | GLOBAL |
| user | com.liferay.portal.kernel.model.User | GLOBAL |
| user2 | com.liferay.portal.kernel.model.User (esta variable está disponible en las plantillas del área de usuario) | GLOBAL |
| userGroupPermission | com.liferay.portal.kernel.service.permission.UserGroupPermission | GLOBAL |
| userPermission | com.liferay.portal.kernel.service.permission.UserPermission | GLOBAL |
| user_birthday | java.util.Date | THEME |
| user_comments | String | THEME |
| use_company_logo | String | THEME |
| user_email_address | String | THEME |
| user_first_name | String | THEME |
| user_greeting | String | THEME |
| user_id | long | THEME |
| user_initialized | boolean | THEME |
| user_last_login_ip | String - IP desde la que se hizo el último login del usuario conectado | THEME |
| user_last_name | String | THEME |
| user_login_ip | String - IP desde la que se hizo el login del usuario | THEME |
| user_middle_name | String | THEME |
| user_name | String | THEME |
| utilLocator | com.liferay.portal.template.UtilLocator | GLOBAL |
| validator | com.liferay.portal.kernel.util.Validator_IW | GLOBAL |
| w3c_language_id | String - Equivalente a $localeUtil.toW3cLanguageId($themeDisplay.getLanguageId())) | THEME |
| webServerToken | com.liferay.portal.kernel.webserver.WebServerServletToken (tiene el mismo valor que la variable imageToken) | GLOBAL |
| windowStateFactory | com.liferay.portal.kernel.portlet.WindowStateFactory_IW | GLOBAL |
| xmlRequest | String - Equivalente a $portletRequestModelFactory.getPortletRequestModel().toXML() | GLOBAL |
Ejemplos
accountPermission
$accountPermission.check(permissionChecker, themeDisplay.getAccount(), "VIEW")
language
es_ES
layout
$layout.getFriendlyURL(locale)
user_birthday
2018-09-06 20:20:28.322
w3c_language_id
es_ES
Cargando comentarios...