Posts

Showing posts from January, 2014

Accessing the image from theme

Some times it may requires to access the image from the theme. So here we go, view.jsp <%@taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %> <liferay-theme:defineObjects/> <img src="${ themeDisplay.getPathThemeImages() }/info.png" /> Here  themeDisplay.getPathThemeImages() gets the default image path as (< your theme name> /images ) If you create a custom folder in images folder then you have to give folder name after the  themeDisplay.getPathThemeImages().

Embedding the Web content or journal article in a portlet

Image
We can insert the webcontent in a custom portlet. 1. Create the New webcontent - click on the Add button select the basic web content . Enter some dummy data and click on the save to save the changes. After creation of the webcontent it generates the articleId as shown below. Use this tag to generate the webcontent <liferay-ui:journal-article articleId="113701" groupId="<%=themeDisplay.getScopeGroupId() %>"></liferay-ui:journal-article>

Defining the Configuration in setting

Image
In Liferay Core portlets you can see the portlet in setting tab as Add the following entry in the liferay-portlet.xml after icon tag as                    <configuration-action-class>                              com.liferay.portal.kernel.portlet.DefaultConfigurationAction                 </configuration-action-class> and define the following in the portlet.xml as     <init-param> <name>config-template</name> <value>/html/test/config.jsp</value> </init-param> In Config.jsp If you want to save the entries in the preferences  it is very simple <liferay-portlet:actionURL var="configURL" portletConfiguration = "true"/>     <aui:form action="${configURL}">          1. <aui:input type="hidden" name="cmd" value="update"/>                 2. <aui:input  name="perferences--test--"/>       </aui:form> H

Setting edit mode - Perference

Image
We can enable edit mode for a portlet by setting the init param in portlet.xml <init-param>      <name>edit-template</name>      <value>/html/jsp/edit.jsp</value> </init-param> Create edit.jsp(name can be anything)  . Then you can see the following image in the setting. When we click on the preference by default the following method executes. public void doEdit( RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { ---------------- ------------------- }

Adding and getting init parameters

We will be adding the init parameters in the portal.xml as         <init-param>              <name>Height</name>              <value>200</value>         </init-param> String name = getInitParameter("Height"); //200 Enumeration<String> names = getInitparameterNames(); // It gives the all init parameters In JSP         portletConfig.getInitParameter("Height");