Recent Bloggers

Sandeep Sapra

2 Publications
17 novembre 2017

Zeno Rocha

17 Publications
7 novembre 2017

Yasuyuki Takeo

3 Publications
5 novembre 2017

John Feeney

1 Publications
3 novembre 2017

Gregory Amerson

30 Publications
3 novembre 2017

Minhchau Dang

13 Publications
3 novembre 2017

Petteri Karttunen

5 Publications
30 octobre 2017

Alex Swain

2 Publications
27 octobre 2017

Jamie Sammons

10 Publications
23 octobre 2017

Jan Verweij

2 Publications
23 octobre 2017

A wild structure type has appeared!

Technical Blogs 25 octobre 2016 Par Travis Cory Staff

People playing around with the new features of Liferay may have noticed something very interesting when creating web content structures. What is it you might ask? It is a way to embeded web content articles into other articles!


But wait, how do I use this stinking thing?


Using DDM Journal Article Structure


If you've already tried to use this you may notice that when you use the usual getData() it returns a JSON string containing the className and classPK of the article. Cool, but I don't have access to serviceLocator and don't know how to get the display of the content. Well you can, thanks to <@liferay_ui['asset-display'] />. Lets see the template.

As we can see above, by using the taglib we are able to pass in those two values that the structure gives us and display our web content. Because we are referencing the primary key of the article, if we make revisions those changes will be reflected when displaying the content.


But why should I care?


Good question, I mean this is a cool feature but how does it help accomplish your needs? Imagine you've created some great copy that you want to use throughout your site. You want to use it on a landing page with some other content to make some nice columns, but you also want to include it by itself on another page. And who wants to repeat themselves? With this, you can make your content and get it looking exactly how you need it to look, then you can use this new structure type to embeded it wherever you need it! And since you are creating a new template, you can rearrange how you want the articles to be displayed on the page without changing the embeded articles template.


But wait, there is more...


Imagine that I do want to change the template of the embeded article so that the markup is different depending on how it is being used. Lets look at some templates:



In this template I am using freeMarkerPortletPreferences.setValue("view", "basicContentView") to set my own custom preference. I've given it a value that is unique so that nothing else is disrupted. And here is another template where I am using the Bootstrap 3 markup for the carousel:


Again I am using the same pattern to set a unique view preference. But what about in the template I am embedding? I've created a basic structure and template for displaying a picture and some text. But I want to display it differently if I am creating a carousel or displaying them all together. So lets take a peak at how this affects my card template:



In this template we check to see what view has been set, and provide a default view if none is set. Look at this gif to see this in action:



The two web content articles on the left are displaying the web content articles on the right. You can see the template's I've included above to see how using the preferences to set a custom value allows us to change the way a web content template is displayed on the page. 


Enjoy using this new feature!

How to approach a new project

Company Blogs 5 février 2015 Par Travis Cory Staff

TL;DR Understanding the purpose and goals of your client will help you develop meaningful and efficient code. Focus on one task at at time.

Approximate reading time: 3 minutes

As a consultant here at Liferay there are plenty of great clients to work with. Each engagement provides me with the change to develop my skills and design process. I had the opportunity to be a part of project last year that taught me a number of important skills. These are not necessarily unique nor are they new; however, I have found there are many advantages to be had from reading different insights. I would like to share a couple things I learned from my last project.

Imagine working with over a thousand pages that provide visitors with important information. The pages have been developed over a long period of time and there are many different design patterns used. Imagine being told you need to migrate these pages from where they currently are to an instance of Liferay. It is going to be a long process, it is not going to be easy, and there are a number of tools that will need to be developed. Remember your towel and don’t panic.

Don't Panic


When I approached the tasks I was given I panicked. I tried to do too much at once and thought that if I concurrently developed my tasks for my client to see they might be more pleased with the project. This was the wrong way to approach my problems. Towards the end of the project there were a number of loose ends that needed to be taken care of. These were problems that could have been avoided if I would have stayed focused on one task at a time. I’ve learned a lesson from Ron Swanson, “never half ass two things, whole ass one thing” thanks Ron.

Ron Swanson saying, 'I'm really proud of you.


The ambition to accomplish goals is great. I had a lot of joy seeing the puzzle pieces come together during the project. The only problem is that deep understanding did not back my development. My code was functioning (not always perfect) yet I did not understand my client. The gap in understanding quickly led to cynicism and project fatigue. Take the time to understand your client and know why they exist. Taking the time to understand the how and why of your client before you develop will give you direction and clarity to create clean and useful code.

There was a lot of stress in my last project. Client frustration and daunting tasks quickly gave way to stressful weeks and late nights. It was not until about half way through the project that I reevaluate my motives. I lost sight of the goals of the project in my stress. It was a blessing that I was concurrently playing bassoon for a friend’s musical composition. Doing something I loved allowed me to approach my project with a new perspective. As a developer it is necessary to take time away from the computer to invest in the people and things you love. These moments were crucial for developing a greater appreciation for web development.

Person walking away from computer


There are a lot of potential frustrations that can come when working with clients. There will be mistakes made and lessons learned. I’ve had to come to the realization that as the web continues to change, my work will probably be redone by someone else sooner rather than later. Understanding the heart of the client’s organization helps you to create a good product that will be out live any revisions.

Grabbing Asset Tag through Wiki ADT

Technical Blogs 27 février 2014 Par Travis Cory Staff

Liferay 6.2 brings the era of the application display template (ADT) into full swing. There have been some awesome posts about how to use the ADT. For more information about ADT see this page, this page, this page, etc.


Right, right, sorry, as you can see, there are many uses of ADT. It allows you to write a new template for a portlet so that it is displayed in whatever manner you like. This can be acheived through the use of Freemarker, or Velocity. Today I will show you a ADT I created for the Wiki portlet using Freemarker.

The Task

As with any asset, it is possible to "tag" an entry. This allows a user to see all organize and navigate through assets based on tags. What if you wanted to have a different way to display a wiki page if it had a specifc tag. What if you wanted to grab just one tag and create a new layout for the wiki based on the tag? What if I told you this was possible with ADT?



Mission Possible

So I set off to make myself a fancy ADT. I borrowed from the Social Wiki ADT to make sure I was calling all the macros right. This is important so that you do not lose your icons.  We will use the tag "cat-meme" to demonstrate our ADT. So first lets create three wiki pages, one with just the tag "cat-meme", one with two tags, and one without the tag "cat-meme".


Now it is time to apply the ADT to our page. Hold on tight!




The Results

Here are the results of our ADT!


As you can see, the pages that have the tag "cat-meme" receive separate styling than the pages without tags. If you wanted to use multiple tags you can use  <#elseif tags?seq_contains("[tag-name]")> .


The exact code I used is shown below. Thanks for reading, happy ADT-ing!




Web Content Instagram Carousel

Technical Blogs 18 novembre 2013 Par Travis Cory Staff

Have you ever thought that Liferay could use a little more Instagram? With the power of the Instagram API and the mighty Alloy-UI resource it is possible to integrate Instagram onto your page. Better yet, you can create a carousel to hold the images! See this page for more information about the Alloy-UI carousel. See this great blog post on how to create a carousel for use as a web content display.


A web content dispaly consists of two elements, the structure and the template. I will show you the structure to use for both 6.1.x and the newly released 6.2.x. Without any further delay, the structure!



  • 6.1.x
  • 6.2.x


As you can see, there is a difference between the structures for both versions. In this template I am giving the user the option to pick the number of photos to display from Instagram (note that the maximum of photo's that can be displayed is 20), and the option to choose how long each photo will be displayed. If you take a look at the Instagram API you can see that it would also be possible to include options for tags, types of media, likes, comments, etc. For more information about how to include those feel free to leave a comment and I can create a blog post about how to incorporate those features. The best way to figure out how to get it to work is experimenting with the API.












As you can see, I am creating some basic styles for the Carousel. Note that you can change all of these styles for whatever you want. You may be asking yourself where a user might find the User Id and Access Token information. These are given out by Instagram. The best way to aquire these is to sign up for developer access with Instagram here. The site will list information about the different end-points (comments, likes, tags) and also how to access various information to display on your page. 


There you have it, a beginner and basic Instagram Alloy-UI Carousel, if you have any questions feel free to ask and I encourage you to explore more of the API. It is really cool! For a live demo of the carousel check out World Imapct, I created the carousel for their site. Thanks for reading, see you next time!










Affichage de 4 résultat(s).