26 June, 2012

Read repeatable data


Hi Everyone,

If you guys are thinking to read repeatable  data from structure and want to fatch in template, Just see and use below code :
In Structure :
<root>
  <dynamic-element index-type="text" name="name" repeatable="true" type="text">
    <dynamic-element index-type="" name="link" repeatable="false" type="text"></dynamic-element>
  </dynamic-element>
</root>

In Template :
<div class="community-names" style="background: none repeat scroll 0 0 #73B3DE; float: left; padding: 5px 0 5px 205px; width: 100%;">
#foreach ($communityname IN $name.getSiblings())
<a href="http://www.blogger.com/$communityname.link.getData%28%29">
    $communityname.getData()  
</a>   
 #end

</div>
</div>

19 June, 2012

Show all pages in theme

You can write below code in theme to list out all the pages(Hidden also) which we have created through GUI:

#set($layoutLocalService = $serviceLocator.findService("com.liferay.portal.service.LayoutLocalService"))
#set($topPublicLayouts = $layoutLocalService.getLayouts($layout.getGroupId(),false)) 
#foreach($layout_page in $topPublicLayouts)

12 June, 2012

service.xml file with order by clause


The attributes of the order-column element allows you to fine tune the ordering
of the entity.


<order by="asc">
<order-column name="title" />
</order>
The above settings will order by title in an ascending manner.
<order by="asc"><order-column name="parentLayoutId" />
<order-column name="priority" />

</order>


The above settings will order by parentLayoutId and then by priority in an ascending manner.
<order by="asc">
<order-column name="name" case-sensitive="false" />
</order>

The above settings will order by name and will not be case sensitive.
<order>
<order-column name="articleId" order-by="asc" />
<order-column name="version" order-by="desc" />
</order>

The above settings will order by articleId in an ascending manner and then by
version in a descending manner.

Portlet Unit Testing with Liferay 6


I must admit, I am a bit obsessed with automated tests. Whenever I approach the development of a new project with a new system, one of my main concerns is how can we implement and run unit tests? So when I tackled the development of a Liferay portlet I assumed that a unit testing framework or practice was a given, Surely someone (if not the Liferay folks) had mastered and documented this aspect of portlet development. Well, Googling and searching for this revealed that no one seemed to have documented a simple and elegant solution to this need. It is easy to test the base Liferay portlets that can be found in the Liferay SDK and source. However, running Unit tests for a portlet in a separate Eclipse project poses a few challenges as mentioned in the following Liferay forum article:http://www.liferay.com/community/forums/-/message_boards/message/3827878.

05 June, 2012

zk-zul integration with liferay

Hi liferay Rockers,

I really feel nice to write this blog because i am also new to zk-zul framework.
I just started hands on this framework and i want to integrate with  liferay.
So finally i have created very simple portlet using zk framework and 
Steps are given below :