Foros de discusión

how to include jquery plugins in our own theme

thumbnail
path finder liferay, modificado hace 13 años.

how to include jquery plugins in our own theme

Expert Mensajes: 262 Fecha de incorporación: 18/09/09 Mensajes recientes
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, modificado hace 13 años.

RE: how to include jquery plugins in our own theme

Regular Member Mensajes: 128 Fecha de incorporación: 31/07/08 Mensajes recientes
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, modificado hace 13 años.

RE: how to include jquery plugins in our own theme

Expert Mensajes: 262 Fecha de incorporación: 18/09/09 Mensajes recientes
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, modificado hace 13 años.

RE: how to include jquery plugins in our own theme

Regular Member Mensajes: 128 Fecha de incorporación: 31/07/08 Mensajes recientes
inside head tag.

<head>
#js ("$javascript_folder/xx/xx/sample.js")
</head>
thumbnail
path finder liferay, modificado hace 13 años.

RE: how to include jquery plugins in our own theme

Expert Mensajes: 262 Fecha de incorporación: 18/09/09 Mensajes recientes
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, modificado hace 13 años.

RE: how to include jquery plugins in our own theme

Junior Member Mensajes: 62 Fecha de incorporación: 17/11/09 Mensajes recientes
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, modificado hace 13 años.

RE: how to include jquery plugins in our own theme

Expert Mensajes: 262 Fecha de incorporación: 18/09/09 Mensajes recientes
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, modificado hace 12 años.

RE: how to include jquery plugins in our own theme

Expert Mensajes: 329 Fecha de incorporación: 10/02/11 Mensajes recientes
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, modificado hace 11 años.

RE: how to include jquery plugins in our own theme

Junior Member Mensajes: 97 Fecha de incorporación: 24/02/12 Mensajes recientes
nice post...very helpful