Fórumok

how to include javascript code in portal_normal.vm

thumbnail
Rewati Raman, módosítva 11 év-val korábban

how to include javascript code in portal_normal.vm

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

RE: how to include javascript code in portal_normal.vm

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

RE: how to include javascript code in portal_normal.vm

Junior Member Bejegyzések: 97 Csatlakozás dátuma: 2012.02.24. Legújabb bejegyzések
thanks kavita
thumbnail
Hitoshi Ozawa, módosítva 11 év-val korábban

RE: how to include javascript code in portal_normal.vm

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

RE: how to include javascript code in portal_normal.vm

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

RE: how to include javascript code in portal_normal.vm

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

RE: how to include javascript code in portal_normal.vm

Junior Member Bejegyzések: 97 Csatlakozás dátuma: 2012.02.24. Legújabb bejegyzések
thanks Amit,

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

Regards
Rewati Raman.
thumbnail
Omar Samir, módosítva 8 év-val korábban

RE: how to include javascript code in portal_normal.vm

Junior Member Bejegyzések: 29 Csatlakozás dátuma: 2015.05.19. Legújabb bejegyzések
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 ????