Fórumok

How to include JavaScript Library in a Liferay 6.2 GA4 Theme

thumbnail
Omar Samir, módosítva 8 év-val korábban

How to include JavaScript Library in a Liferay 6.2 GA4 Theme

Junior Member Bejegyzések: 29 Csatlakozás dátuma: 2015.05.19. Legújabb bejegyzések
Hello Everyone

In my portlet I use 2 javascript libraries and I include them in liferay-portlet.xml and after generating my ( .war ) file and deploy it to my theme ,, the portlet uses the 2 javascript libraries at the first time and after refresh the page all the content of portlet disappears so the portlet not still uses the javascript libraries ,, I searched for this issue and I found that I must include my javascript files in liferay theme and declare them in file called "Portal_normal.vm" ,, the problem now
I can't get the path of where I should include my javascript libraries and the full path of the "portal_normal.vm" that I must declare the libraries in it ,,


I need help to find the desired paths for javascript libraries declaration !!

sorry for prolongation

thanks in advance ,, emoticon
thumbnail
Miroslav Ligas, módosítva 8 év-val korábban

RE: How to include JavaScript Library in a Liferay 6.2 GA4 Theme (Válasz)

Regular Member Bejegyzések: 152 Csatlakozás dátuma: 2014.07.29. Legújabb bejegyzések
Hi

If you use portlet specific JS libraries that have no usage in other parts of the portal you should not include them in the theme. The declaration in liferay-portlet.xml is fine. Just make sure that you use the right tag - header-portlet-javascript.

If you have common JS libraries that are used all over the portal (e.g. jQuery...) then it might be desirable to place them in the theme. You need to create your new costume theme. and in the theme you can add the portal_normal.vm template. There in the header you use HTML script tag to include the common libraries. bear in mind that you creating a dependency between your theme and portlet application.
thumbnail
Omar Samir, módosítva 8 év-val korábban

RE: How to include JavaScript Library in a Liferay 6.2 GA4 Theme

Junior Member Bejegyzések: 29 Csatlakozás dátuma: 2015.05.19. Legújabb bejegyzések
Miroslav Ligas:
Hi

If you use portlet specific JS libraries that have no usage in other parts of the portal you should not include them in the theme. The declaration in liferay-portlet.xml is fine. Just make sure that you use the right tag - header-portlet-javascript.

If you have common JS libraries that are used all over the portal (e.g. jQuery...) then it might be desirable to place them in the theme. You need to create your new costume theme. and in the theme you can add the portal_normal.vm template. There in the header you use HTML script tag to include the common libraries. bear in mind that you creating a dependency between your theme and portlet application.





Hello Miroslav ,,

Thanks alot ,, I found that I use a wrong tag <header-portal-javascript> instead of <header-portlet-javascript> and also I edited some default js tags uses <footer-portlet-javascript> to header one ,, thanks dear Very Good