user818700
user818700

Reputation:

Easy way of creating tabs in a Liferay portlet?

Ello there,

Does anyone know of an easy way to create tabs in a Liferay portlet? Been reading up on it and I just can't seem to find any suggestions on how to do this quite easily.

Would be great if someone that has experience with this could give me some pointers.

Thanks!

Upvotes: 2

Views: 3863

Answers (1)

rp.
rp.

Reputation: 3465

Use the Liferay UI TagLib!

First import the TagLib,

<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>

Now you can use this,

<liferay-ui:tabs
    names="questions,tags,users,badges,unanswered"
    param="tab"
    url="<%= myURL.toString() %>"
/>
  • The name attribute is comma separated with the names of your Tab.
  • The url attribute will be a URL where the param attribute will be appended to as a param.

Alternatively, you can explicitly set the URL for each tab.

<liferay-ui:tabs
    names="questions,tags,users,badges,unanswered"
    url1="<%= questionsURL.toString() %>"
    url2="<%= tagsURL.toString() %>"
    url3="<%= usersURL.toString() %>"
    url4="<%= badgesURL.toString() %>"
    url5="<%= unansweredURL.toString() %>"
/>

Upvotes: 6

Related Questions