Forums de discussion

Portlet Icon Not Showing

thumbnail
Richard Cantor, modifié il y a 14 années.

Portlet Icon Not Showing

New Member Publications: 17 Date d'inscription: 18/03/09 Publications récentes
Hello all,

I'm using LifeRay 5.2.3

I created a custom portlet and copiedit it into the deploy folder so hot deploy deploys the portlet. My portlet webapp is now located under /webapps/...

Everything works fine except when I put the <icon></icon> tag in the liferay-portlet.xml directly under the <portlet-name> tag, the icon never shows.

In fact, when I look in the source jsp (/html/taglib/portlet/icon_portlet/page.jsp) where it supposed to grab the path to the icon with this call... src = portlet.getContextPath() + portlet.getIcon(); I get "null". If the path is wrong to the icon, it would spit out the path and not null, but I am simply getting null which means liferay is not reading the <icon></icon tag correctly or doesn;t know it's there.

Lastly, when I check this call from the same JSP: showPortletIcon = portletDisplay.isShowPortletIcon(); it returns "false".

Can someone please help???

Here is my liferay-portlet.xml (very simple emoticon)

<liferay-portlet-app>
<portlet>
<portlet-name>com.ravagoamericas.portlets.SpecSheetGenerator.SpecSheetGenerator</portlet-name>
<icon>icon.png</icon>
<instanceable>true</instanceable>
<private-session-attributes>true</private-session-attributes>
</portlet>
<role-mapper>
<role-name>administrator</role-name>
<role-link>Administrator</role-link>
</role-mapper>
<role-mapper>
<role-name>guest</role-name>
<role-link>Guest</role-link>
</role-mapper>
<role-mapper>
<role-name>power-user</role-name>
<role-link>Power User</role-link>
</role-mapper>
<role-mapper>
<role-name>user</role-name>
<role-link>User</role-link>
</role-mapper>
</liferay-portlet-app>

Thanks all,

-Rich
thumbnail
Thomas Berg, modifié il y a 14 années.

RE: Portlet Icon Not Showing

Regular Member Publications: 131 Date d'inscription: 07/09/09 Publications récentes
Hello Richard,

It's been a while since you posted this so maybe you've already sorted this out.

Try using

<icon>/icon.png</icon>

instead of

<icon>icon.png</icon>


This should work, assuming your icon.png file is located in the same directory as your WEB-INF folder

/ Thomas
thumbnail
ilke Muhtaroglu, modifié il y a 14 années.

RE: Portlet Icon Not Showing

Regular Member Publications: 226 Date d'inscription: 12/05/09 Publications récentes
I tried what is guided here


<icon>/icon.png</icon>


my icon.png in my WEB-INF Directory.

But the at Liferay portal i can not see the icon but the Portlet display name appears instead of the icon!

I am using Icefaces, can it be due to javascript conflict or so ???

Any help is appreciated.


ilke
thumbnail
Thomas Berg, modifié il y a 14 années.

RE: Portlet Icon Not Showing

Regular Member Publications: 131 Date d'inscription: 07/09/09 Publications récentes
Hi Ilke,

The path to the icon image file should be given relative to the docroot-folder (webcontent-folder). So if your image is called icon.png and is placed in docroot/WEB-INF/icon.png, the path in liferay-portlet.xml should be :

<icon>/WEB-INF/icon.png</icon>


In my previous post, the image is assumed to be located in the docroot-folder which is default when creating a portlet with the plugins sdk.

Hope this helps!

Regards Thomas
thumbnail
ilke Muhtaroglu, modifié il y a 14 années.

RE: Portlet Icon Not Showing

Regular Member Publications: 226 Date d'inscription: 12/05/09 Publications récentes
thanx,

it worked!

I copied the png file to Web Content Directory (next to jspx files) and gave the path as

<icon>/phoneBook1.png</icon>

result is a smiling face ;)

Liferay rules!

ilke