Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Path Finder LifeRay
how to include jquery plugins in our own theme
April 21, 2010 10:12 PM
Answer

Path Finder LifeRay

Rank: Expert

Posts: 262

Join Date: September 18, 2009

Recent Posts

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 Ramachandran
RE: how to include jquery plugins in our own theme
April 21, 2010 11:18 PM
Answer

Babu Janarthanan Ramachandran

Rank: Regular Member

Posts: 132

Join Date: July 30, 2008

Recent Posts

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
Path Finder LifeRay
RE: how to include jquery plugins in our own theme
April 21, 2010 11:47 PM
Answer

Path Finder LifeRay

Rank: Expert

Posts: 262

Join Date: September 18, 2009

Recent Posts

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 Ramachandran
RE: how to include jquery plugins in our own theme
April 21, 2010 11:57 PM
Answer

Babu Janarthanan Ramachandran

Rank: Regular Member

Posts: 132

Join Date: July 30, 2008

Recent Posts

inside head tag.

<head>
#js ("$javascript_folder/xx/xx/sample.js")
</head>
Pravin Pawar
RE: how to include jquery plugins in our own theme
April 22, 2010 12:04 AM
Answer

Pravin Pawar

Rank: Junior Member

Posts: 62

Join Date: November 17, 2009

Recent Posts

You can include it in head part like below...

1<head>
2      #js ("/html/themes/my-theme/javascript/home.js")
3</head>
4<body>


So it will be converted like below in your generated HTML

<script src="/html/themes/my-theme/javascript/home.js" type="text/javascript"></script>
Path Finder LifeRay
RE: how to include jquery plugins in our own theme
April 22, 2010 12:34 AM
Answer

Path Finder LifeRay

Rank: Expert

Posts: 262

Join Date: September 18, 2009

Recent Posts

Pravin Pawar:
You can include it in head part like below...

1<head>
2      #js ("/html/themes/my-theme/javascript/home.js")
3</head>
4<body>




Thanks Pravin for your quick reply
as u said i've included that line in portal_normal.vm as shown below
1
2<head>
3    <title>$the_title - Datatreis</title>
4
5    $theme.include($top_head_include)
6    #js ("/html/themes/threePL/javascript/jquery.tablesorter.js")
7</head>


but nothing seems to be working.... please help me
Path Finder LifeRay
RE: how to include jquery plugins in our own theme
April 22, 2010 1:28 AM
Answer

Path Finder LifeRay

Rank: Expert

Posts: 262

Join Date: September 18, 2009

Recent Posts

Babu Janarthanan:
inside head tag.

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


Thanks Babu it worked when i included in your way...
Prakash Khanchandani
RE: how to include jquery plugins in our own theme
June 28, 2011 7:06 AM
Answer

Prakash Khanchandani

Rank: Expert

Posts: 261

Join Date: February 10, 2011

Recent Posts

Hi,

Thanks.

It worked for me, when I used this:
1#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:
1
2<head>
3#js ("$javascript_folder/sample.js")
4</head>

and if the folder is docroot/_diffs/javascript/others/againothers/sample.js
then the code would be:
1
2<head>
3#js ("$javascript_folder/others/againothers/sample.js")
4</head>
Rewati Raman
RE: how to include jquery plugins in our own theme
January 24, 2013 10:47 AM
Answer

Rewati Raman

Rank: Junior Member

Posts: 97

Join Date: February 24, 2012

Recent Posts

nice post...very helpful