Fórumok

how to include jquery plugins in our own theme

thumbnail
path finder liferay, módosítva 13 év-val korábban

how to include jquery plugins in our own theme

Expert Bejegyzések: 262 Csatlakozás dátuma: 2009.09.18. Legújabb bejegyzések
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, módosítva 13 év-val korábban

RE: how to include jquery plugins in our own theme

Regular Member Bejegyzések: 128 Csatlakozás dátuma: 2008.07.31. Legújabb bejegyzések
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, módosítva 13 év-val korábban

RE: how to include jquery plugins in our own theme

Expert Bejegyzések: 262 Csatlakozás dátuma: 2009.09.18. Legújabb bejegyzések
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, módosítva 13 év-val korábban

RE: how to include jquery plugins in our own theme

Regular Member Bejegyzések: 128 Csatlakozás dátuma: 2008.07.31. Legújabb bejegyzések
inside head tag.

<head>
#js ("$javascript_folder/xx/xx/sample.js")
</head>
thumbnail
path finder liferay, módosítva 13 év-val korábban

RE: how to include jquery plugins in our own theme

Expert Bejegyzések: 262 Csatlakozás dátuma: 2009.09.18. Legújabb bejegyzések
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, módosítva 13 év-val korábban

RE: how to include jquery plugins in our own theme

Junior Member Bejegyzések: 62 Csatlakozás dátuma: 2009.11.17. Legújabb bejegyzések
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, módosítva 13 év-val korábban

RE: how to include jquery plugins in our own theme

Expert Bejegyzések: 262 Csatlakozás dátuma: 2009.09.18. Legújabb bejegyzések
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, módosítva 12 év-val korábban

RE: how to include jquery plugins in our own theme

Expert Bejegyzések: 329 Csatlakozás dátuma: 2011.02.10. Legújabb bejegyzések
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, módosítva 11 év-val korábban

RE: how to include jquery plugins in our own theme

Junior Member Bejegyzések: 97 Csatlakozás dátuma: 2012.02.24. Legújabb bejegyzések
nice post...very helpful