Foren
js files in portlet
Abhi Ed, geändert vor 11 Jahren.
js files in portlet
Regular Member Beiträge: 118 Beitrittsdatum: 04.06.12 Neueste Beiträge
Hello Freinds ,
I need to load a js file faster, the lower rate of loading of this file is affecting my portal performance.
I have given it a though to load the js files in themes and then referring it in a portlet
So now, my problem is how to get js files in portlets once they are present in themes
Any suggestions?
I need to load a js file faster, the lower rate of loading of this file is affecting my portal performance.
I have given it a though to load the js files in themes and then referring it in a portlet
So now, my problem is how to get js files in portlets once they are present in themes
Any suggestions?
Manali Lalaji, geändert vor 11 Jahren.
RE: js files in portlet
Expert Beiträge: 362 Beitrittsdatum: 09.03.10 Neueste Beiträge
Hi Abhi,
The portlet specific files can be kept in portlet itself. You can keep in js folder of your portlet.
You can load them, by keeping in footer in liferay-portlet.xml.
e.g <footer-portlet-javascript>/js/singlefileupload.js</footer-portlet-javascript>
The themes should contain the js which are to be referred globally by multiple portlets like min files.
They can be directly accessed directly in your portlet.
Hope this helps.
Thanks,
Manali
The portlet specific files can be kept in portlet itself. You can keep in js folder of your portlet.
You can load them, by keeping in footer in liferay-portlet.xml.
e.g <footer-portlet-javascript>/js/singlefileupload.js</footer-portlet-javascript>
The themes should contain the js which are to be referred globally by multiple portlets like min files.
They can be directly accessed directly in your portlet.
Hope this helps.
Thanks,
Manali
Abhi Ed, geändert vor 11 Jahren.
RE: js files in portlet
Regular Member Beiträge: 118 Beitrittsdatum: 04.06.12 Neueste BeiträgeManali Lalaji:
Hi Abhi,
The portlet specific files can be kept in portlet itself. You can keep in js folder of your portlet.
You can load them, by keeping in footer in liferay-portlet.xml.
e.g <footer-portlet-javascript>/js/singlefileupload.js</footer-portlet-javascript>
The themes should contain the js which are to be referred globally by multiple portlets like min files.
They can be directly accessed directly in your portlet.
Hope this helps.
Thanks,
Manali
Thanks Manali for ur response .
I can see the js files are available in portal once I include them in themes.
But , my portlets don't access it.
Do u mean we can use ThemeDsiplay object to get js files in our portlet ?
Ed
Manali Lalaji, geändert vor 11 Jahren.
RE: js files in portlet
Expert Beiträge: 362 Beitrittsdatum: 09.03.10 Neueste Beiträge
Hi Abhi,
Once the js files are added in portal_normal.vm of theme,
e.g <script type="text/javascript" src="$javascript_folder/jquery.multiselect.js"></script>
this js becomes available to all portlets on load of page.
So you can directly use the function defined in that js. There is no need of using any Themedisplay object to fetch content.
If issue still persists, please explain exact scenerio, where is it failing.
Thanks,
Manali
Once the js files are added in portal_normal.vm of theme,
e.g <script type="text/javascript" src="$javascript_folder/jquery.multiselect.js"></script>
this js becomes available to all portlets on load of page.
So you can directly use the function defined in that js. There is no need of using any Themedisplay object to fetch content.
If issue still persists, please explain exact scenerio, where is it failing.
Thanks,
Manali
Hitoshi Ozawa, geändert vor 11 Jahren.
RE: js files in portlet
Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
Remember that loading a js file in a theme would load the js on every page. If performance is the problem, it may just be better to have a httpd server up front and move all images and js file to the httpd server so they would be cached.
Abhi Ed, geändert vor 11 Jahren.
RE: js files in portlet
Regular Member Beiträge: 118 Beitrittsdatum: 04.06.12 Neueste BeiträgeHitoshi Ozawa:
Remember that loading a js file in a theme would load the js on every page. If performance is the problem, it may just be better to have a httpd server up front and move all images and js file to the httpd server so they would be cached.
Can u simplify ur statement sir?
I guess you are using httpd in context of http only or https?
Regards Ed