留言板

Javascript

Arjun Narahari,修改在9 年前。

Javascript

New Member 帖子: 9 加入日期: 14-8-25 最近的帖子
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,修改在9 年前。

RE: Javascript

Expert 帖子: 358 加入日期: 10-11-17 最近的帖子
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,修改在9 年前。

RE: Javascript

New Member 帖子: 9 加入日期: 14-8-25 最近的帖子
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,修改在9 年前。

RE: Javascript

Junior Member 帖子: 44 加入日期: 13-12-20 最近的帖子
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,修改在9 年前。

RE: Javascript

Expert 帖子: 362 加入日期: 10-3-9 最近的帖子
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,修改在9 年前。

RE: Javascript

Junior Member 帖子: 44 加入日期: 13-12-20 最近的帖子
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!