フォーラム

ホーム » Liferay Sync

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
Rewati Raman
how to include javascript code in portal_normal.vm
2012/06/14 7:06
答え

Rewati Raman

ランク: Junior Member

投稿: 97

参加年月日: 2012/02/24

最近の投稿

i had designed the page using simple html5/css3 and javascript concepts without using liferay
now i want to integrate that web page specially the javascript codes that i had written in the portal_normal.vm into the theme........
i m not getting the appropriate solution to include Jquery library js file and other js files to the theme......
is there any solutions for that
Kavita Gupta
RE: how to include javascript code in portal_normal.vm
2012/06/14 10:11
答え

Kavita Gupta

ランク: Junior Member

投稿: 64

参加年月日: 2008/03/12

最近の投稿

Hi,

You can directly include js in portal_normal.vm as you are doing with normal html.

You can use <script src ... > to include the js.

Regards,
Kavita
Rewati Raman
RE: how to include javascript code in portal_normal.vm
2012/06/14 21:00
答え

Rewati Raman

ランク: Junior Member

投稿: 97

参加年月日: 2012/02/24

最近の投稿

thanks kavita
Hitoshi Ozawa
RE: how to include javascript code in portal_normal.vm
2012/06/14 15:50
答え

Hitoshi Ozawa

ランク: Liferay Legend

投稿: 7949

参加年月日: 2010/03/23

最近の投稿

Just add the following

<head>
<title>$the_title - $company_name</title>
$theme.include($top_head_include)
<script src="/html/js/jquery/custom/jquery-1.7.2.min.js"></script>
<script src="/html/js/jquery/custom/jquery-ui-1.8.21.custom.min.js"></script>
<link type="text/css" href="/html/css/smoothness/jquery-ui-1.8.21.custom.css" rel="stylesheet"/>
</head>
Rewati Raman
RE: how to include javascript code in portal_normal.vm
2012/06/14 20:59
答え

Rewati Raman

ランク: Junior Member

投稿: 97

参加年月日: 2012/02/24

最近の投稿

thanks hitoshi but we dont have js folder inside html so do we need to create the folders in that structure but by default in theme we have js folder inside the dockroot only and for writing javascript we have main.js inside js folder so do we need to write anything inside main.js.......
thanks again for replying
Amit Doshi
RE: how to include javascript code in portal_normal.vm
2012/06/15 0:32
答え

Amit Doshi

ランク: Liferay Master

投稿: 549

参加年月日: 2010/12/29

最近の投稿

Hi Rewati,

When you create the theme or the portlet with the help of ANT or MAVEN, it will default create the Structure for you.

You will have js,css,html,images etc. folder inside it. So put all the js files in the JS folder, images inside images folder etc.

So if you use in theme, then you can directly access with the help of $javascript_folder(it will use you the path upto javascript) .

So if you are using main.js then in the theme just need to write as below :-

1<script type="text/javascript" src="$javascript_folder/main.js"></script>


And same way for the other JS files in theme.
For more details check this.

In the portlet you can use as below :-

1
2<script type="text/javascript" src="<%=themeDisplay.getPathThemeJavaScript()%>/main.js"></script>


Hope I am clear.

Regards,
Amit Doshi
Rewati Raman
RE: how to include javascript code in portal_normal.vm
2012/06/15 20:10
答え

Rewati Raman

ランク: Junior Member

投稿: 97

参加年月日: 2012/02/24

最近の投稿

thanks Amit,

I think my Problem got solved now....i have to try it out

Regards
Rewati Raman.
Omar Samir
RE: how to include javascript code in portal_normal.vm
2015/05/26 2:12
答え

Omar Samir

ランク: Junior Member

投稿: 29

参加年月日: 2015/05/19

最近の投稿

Hello Rewati

please ,, can you tell me what's the full path of folder that include js files and the full path of portal_normal.vm file ????