留言板

how to include jquery plugins in our own theme

thumbnail
path finder liferay,修改在14 年前。

how to include jquery plugins in our own theme

Expert 帖子: 262 加入日期: 09-9-18 最近的帖子
hello everyone,

Is it possible to include jQuery plugins(js files) in our theme and use it in our portlets without calling that js file in our portlet

my observation:
when we want to use jquery in our portlet for example table sorter we need to include
script src="path/to/js/file.jsp" is it possible that i can include through themes without giving this src in each of our portlets..

please help me to get out of this issue...


Thank you,

Regards,
Path Finder
Babu Janarthanan,修改在14 年前。

RE: how to include jquery plugins in our own theme

Regular Member 帖子: 128 加入日期: 08-7-31 最近的帖子
Hi,
you can include the JS files in portal_normal.vm as mentioned below.

#js ("$javascript_folder/xx/xx/sample.js")

hope it helps you.

Thx,
Babu
thumbnail
path finder liferay,修改在14 年前。

RE: how to include jquery plugins in our own theme

Expert 帖子: 262 加入日期: 09-9-18 最近的帖子
Babu Janarthanan:
Hi,
you can include the JS files in portal_normal.vm as mentioned below.

#js ("$javascript_folder/xx/xx/sample.js")



in which part do i have to include this line...
in body??
Babu Janarthanan,修改在14 年前。

RE: how to include jquery plugins in our own theme

Regular Member 帖子: 128 加入日期: 08-7-31 最近的帖子
inside head tag.

<head>
#js ("$javascript_folder/xx/xx/sample.js")
</head>
thumbnail
path finder liferay,修改在14 年前。

RE: how to include jquery plugins in our own theme

Expert 帖子: 262 加入日期: 09-9-18 最近的帖子
Babu Janarthanan:
inside head tag.

<head>
#js ("$javascript_folder/xx/xx/sample.js")
</head>


Thanks Babu it worked when i included in your way...
thumbnail
Pravin Pawar,修改在14 年前。

RE: how to include jquery plugins in our own theme

Junior Member 帖子: 62 加入日期: 09-11-17 最近的帖子
You can include it in head part like below...


      #js ("/html/themes/my-theme/javascript/home.js")



So it will be converted like below in your generated HTML

<script src="/html/themes/my-theme/javascript/home.js" type="text/javascript"></script>
thumbnail
path finder liferay,修改在14 年前。

RE: how to include jquery plugins in our own theme

Expert 帖子: 262 加入日期: 09-9-18 最近的帖子
Pravin Pawar:
You can include it in head part like below...


      #js ("/html/themes/my-theme/javascript/home.js")





Thanks Pravin for your quick reply
as u said i've included that line in portal_normal.vm as shown below


	<title>$the_title - Datatreis</title>

	$theme.include($top_head_include)
	#js ("/html/themes/threePL/javascript/jquery.tablesorter.js")



but nothing seems to be working.... please help me
thumbnail
Prakash Khanchandani,修改在12 年前。

RE: how to include jquery plugins in our own theme

Expert 帖子: 329 加入日期: 11-2-10 最近的帖子
Hi,

Thanks.

It worked for me, when I used this:
#js ("$javascript_folder/xx/xx/sample.js")

where $javascript_folder evaluates to the path to your javascript folder,
for eg:
If my javascript folder is javascript in docroot/_diffs/javascript/sample.js

then I would have the code in my portal_normal.vm like this:


#js ("$javascript_folder/sample.js")


and if the folder is docroot/_diffs/javascript/others/againothers/sample.js
then the code would be:


#js ("$javascript_folder/others/againothers/sample.js")

thumbnail
Rewati Raman,修改在11 年前。

RE: how to include jquery plugins in our own theme

Junior Member 帖子: 97 加入日期: 12-2-24 最近的帖子
nice post...very helpful