Foros de discusión

Javascript

Arjun Narahari, modificado hace 9 años.

Javascript

New Member Mensajes: 9 Fecha de incorporación: 25/08/14 Mensajes recientes
Hii i m arjun narahari new to liferay working for novelerp solns pvt ltd
my question is

i m creating a website on liferay with the help of jsp , html , css , js
so when i m including a js file or css file in liferay-portlet.xml in header-portlet-javascript and footer-portlet-javascript
is it possible that i can include more than one header-portlet-javascript and footer-portlet-javascript tag in the liferay-portlet.xml file
like this
<header-portlet-javascript>/js/full_bg.js</header-portlet-javascript>
<header-portlet-javascript>/js/dropdown_menu_jquery.js</header-portlet-javascript>

as i m having lots of html files , css files and js files

if thrs another solution plss explain me in detail as to how to display js and css files in my portal , if poss for u as i m new to liferay

plss reply asap
thanking you
thumbnail
Mayur Patel, modificado hace 9 años.

RE: Javascript

Expert Mensajes: 358 Fecha de incorporación: 17/11/10 Mensajes recientes
Hi Arjun,

You can embed all js and css files in theme so that you can make use of same across whole portal, you can load js files in portal_normal.vm and css files inside main.css in theme.

At a later stage of the project, you can also perform javascript minification for performance improvement.

Thanks.
Arjun Narahari, modificado hace 9 años.

RE: Javascript

New Member Mensajes: 9 Fecha de incorporación: 25/08/14 Mensajes recientes
Thanku Mayur
bt i wanted to clarify one more thing
what do i need to do for that theme
if u plss tell me a lil bit in detail it will be a grt help from u
thumbnail
Suraj Bihari, modificado hace 9 años.

RE: Javascript

Junior Member Mensajes: 44 Fecha de incorporación: 20/12/13 Mensajes recientes
Hello Arjun,

It is possible to specify multiple header-portlet-javascript elements in liferay-portlet.xml

<header-portlet-javascript>/js/main.js</header-portlet-javascript>
<header-portlet-javascript>/js/main2.js</header-portlet-javascript>
<header-portlet-javascript>/js/main3.js</header-portlet-javascript>


The script tags will get rendered accordingly within the head tags :-)

HTH!
Suraj
thumbnail
Manali Lalaji, modificado hace 9 años.

RE: Javascript

Expert Mensajes: 362 Fecha de incorporación: 9/03/10 Mensajes recientes
Hi,

Its possible to add multiple javascript files in <header-portlet-javascript>. But you need to maintain the order in which they shall be rendered ,so need to be careful that there are no conflicts. So if there is requirement of having multiple instances (that is, something like web content portlet that can be placed several times in a page) of same portlet on a single page / or having portlet specific javascript you can add in liferay-portlet.xml.
When the page is being rendered, all of the entries are checked, liferay will only load the js file once. Thus, the page is going to load faster.

But if you have javascript files, affecting entire portal, then its advised to put them in Theme and included in portal_normal.vm.

HTH!
thumbnail
Suraj Bihari, modificado hace 9 años.

RE: Javascript

Junior Member Mensajes: 44 Fecha de incorporación: 20/12/13 Mensajes recientes
For reference checkout the documentation

https://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/creating-liferay-them-7

In 'Anatomy of a Theme' you will find portal_normal.vm

HTH!