Custom variables in velocity and freemarker templates in. While developing liferay theme we have used many velocity variables. Lps96866 porygon entry display page template doesnt have thumbnail and fragment entry isnt added to it. Liferay hook that inject custom variables in velocity to do new relic manual instrumentation of web pages.
If you want to use staticutil object then also remove this variable from restricted variables. List of velocity variables in theme template archives. How to set and use custom velocity variables in liferay. We recommend that you convert your velocity theme templates to freemarker at your earliest convenience to avoid future issues. You can feed it parameters, and it will print out a string for you. How to set and use custom velocity variables in liferay first things first. Just choose one of your free or purchased theme, and download the variables. Access liferay global velocity variable in custom portlet. If you have this sort of code distributed all over your theme, i.
Access liferay database services in themesvelocity templates. The recommended location to define custom velocity variables in a theme plugin is in. I would like to know where exactly does liferay get the values for teh velocity variables in the. Code completion for liferay velocity variables are also supported for vm files. Liferay default theme velocity variables, liferay init. These are files that typically have a vm extension all liferay themes make use of this velocity. Introduction to the liferay dxp service liferay learn.
Liferay uses an implementation of the velocity engine to render velocity templates. Liferay theme velocity variables 1 liferay velocity variables 1. Liferay, liferay theme, liferay theme complete tutorial, liferay theme tutorial, liferay6. We can expose our custom variable to templatesfor both velocity and freemarker. Using directory deployment feature, just change a theme css or template files and refresh the browser to see the modification. How to read request parameters from velocity template in. Freemarker template processor has undefined variables. Now we consider the use of velocitymacros in the template of a theme. Embedding portlets within liferay layout template not theme in 5. Liferay already providing many default velocity variables in theme level such as. The liferay dxp service in dxp cloud can be used in many of the same ways as an onpremise instance of. It is important to understand the strengths and weaknesses of each provider so that you can choose the best one that fits your deployment scenario. To expose custom variable for templates in liferay you need to follow the below steps. Hello guys,here, i am writing code for get session attribute in velocity.
If youre using velocity as your template language, youll notice this message on your server console when deploying your theme. Now click on download button then we can download bundle zip file. Start by converting your velocity theme templates to freemarker. Variables available to layout templates liferay help center. Remove servicelocator variable and staticutil from restricted variables by clicking on icon. From modifications to a portal page to thinking about responsive design, you will learn all of the best practices for creating your own theme project. It calls the other velocity template files in the same folder. Take a look at the discussion1 on new relic forums. Here i am going to demonstrate how we can do it for liferay dxp for both velocity and freemarker template. As you can see, you can have a bootstrap theme as a liferay theme in only few minutes. Creating the theme using liferay ide is easiest to learn first. Datasourcefactorybean for the actual implementation. First chapter of book explains how to download, install and configure liferay. Apart from those variables, if at all we end up needing a custom variable, which define a custom functionalityvalue as per the specific business need, we can define them in two places.
Creating a theme project in the plugins sdk liferay. Liferay can use c3po, dbcp, or tomcat for connection pooling. Liferay default theme velocity variables java,liferay. You can select the freemarker or velocity template frameworks for your theme. Liferay developers should know how to properly embed portlets in a liferay theme to improve the usability of the theme without negatively impacting the theme performance. Velocity is a popular template engine for java web applications. Netbeans portal pack, a set of netbeans plugins for. Upgrading frameworks and features step 4 of 4 velocity templates were deprecated in liferay portal 7. How to get session attribute in velocity template in liferay. Hi, today i am going to show you how you can create custom velocity variable in new liferay 6. When we work with theme development we may need to use many velocity variable all these variables are declared in initi. Making themes configurable with settings liferay help center.
Create and modify liferay web space theme in netbeans. Using portal pack for web space liferay theme development. List of velocity variables in liferay liferay savvy. Control menu is not shown if you are using a velocity template. Velocity templates were deprecated in liferay portal ce 7.
The gulp upgrade command reports the required theme template changes in the log. This oneday training covers how a liferay theme works at a code level as well as what configureable options you have in liferay through a theme. If you havent used any of the template languages before, we recommend using freemarker. Control menu does not work in velocity templates liferay. This tutorial shows how to use liferay dxps macros in your freemarker and velocity theme templates. Best way to start with liferay bundle that we can download liferay 7 bundle with tomcat. Macros are not like traditional methods or functions, in that they dont return data, and while they can manipulate text based upon the parameters you pass in, it can only print. At noovle we have need to use the awesome rum metrics to inspect our liferay portal installation. Defining custom velocity variables for liferay themes. We will be able to use custom velocity variable directly in the vm files. A macro is a function that does text manipulation inside of velocity.
Access liferay custom field from velocity template stack. Liferay 7 dxp development and basics of liferay hook. In prior versions of liferay portal, velocity templates. A number of variables are available for you to use in your custom tpl files. Velocity variables in cms template solved forums liferay. Creating a theme project in the plugins sdk edit on github rss opens new window history print. You will direct access to servicelocator object in your application display template. Themes can be limited to certain company ids by including or excluding the themes in the section of webinf liferay lookandfeel. Migrating off of velocity templates liferay help center. Advanced content with structures and templates liferay help. Access objects from velocity in liferay java cum liferay. Join the social network of tech nerds, increase skill rank, get work, manage projects. It runs the applications liferay dxp instance and interacts with other services like the web server, elasticsearch, and mysql database.
1411 1249 943 1411 555 1011 1674 893 352 112 1574 1674 1381 157 620 1024 612 1124 727 502 544 919 280 785 196 929 1617 645 1525 1117 409 594 1025 629 143 1352 676 748 1088 1288 1062 1255 1420 165 789 969 55 989