Fórum

how to include javascript code in portal_normal.vm

thumbnail
Rewati Raman, modificado 11 Anos atrás.

how to include javascript code in portal_normal.vm

Junior Member Postagens: 97 Data de Entrada: 24/02/12 Postagens Recentes
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, modificado 11 Anos atrás.

RE: how to include javascript code in portal_normal.vm

Junior Member Postagens: 64 Data de Entrada: 12/03/08 Postagens Recentes
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
thumbnail
Rewati Raman, modificado 11 Anos atrás.

RE: how to include javascript code in portal_normal.vm

Junior Member Postagens: 97 Data de Entrada: 24/02/12 Postagens Recentes
thanks kavita
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

RE: how to include javascript code in portal_normal.vm

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
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>
thumbnail
Rewati Raman, modificado 11 Anos atrás.

RE: how to include javascript code in portal_normal.vm

Junior Member Postagens: 97 Data de Entrada: 24/02/12 Postagens Recentes
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
thumbnail
Amit Doshi, modificado 11 Anos atrás.

RE: how to include javascript code in portal_normal.vm

Liferay Master Postagens: 550 Data de Entrada: 29/12/10 Postagens Recentes
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 :-

<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 :-


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


Hope I am clear.

Regards,
Amit Doshi
thumbnail
Rewati Raman, modificado 11 Anos atrás.

RE: how to include javascript code in portal_normal.vm

Junior Member Postagens: 97 Data de Entrada: 24/02/12 Postagens Recentes
thanks Amit,

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

Regards
Rewati Raman.
thumbnail
Omar Samir, modificado 8 Anos atrás.

RE: how to include javascript code in portal_normal.vm

Junior Member Postagens: 29 Data de Entrada: 19/05/15 Postagens Recentes
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 ????