Portal Engine
Version 3.x > Portal Engine > Where to put custom .js files? View modes: 
User avatar
Member
Member
christopherhawkins-gmail - 3/18/2009 11:43:56 AM
   
Where to put custom .js files?
Hello all.

I've got some jQuery and other custom .js files that I need to use in my Kentico site. I've tried placing them in /CMSScripts/ and then referencing them from the Master Page like this:

<script type="text/javascript" src="~/CMSScripts/filename.js" charset="ISO-8859-1"></script>

However, the .js doesn't seem to fire. I'm not sure if I have referenced it properly.

Is there a better way to do this?

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 3/19/2009 7:42:09 AM
   
RE:Where to put custom .js files?
Hi Christopher,

Could you please let me know if you are using PortalEngine, or ASPX templates, and what version of Kentico CMS you use? Maybe the tilde character is not resolved. Could you please check this in generated HTML code of the page, eventually try to use JavaScript web part from General category to link the file with javascript?

Best Regards,

Martin Dobsicek

User avatar
Member
Member
theod - 3/30/2009 4:02:44 PM
   
RE:Where to put custom .js files?
I am having the same problem.

I am trying to implement Lightview.

This is what I have pasted into the Header section of the Master Page:

<link href="~/CMSScripts/lightview.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src='~/CMSScripts/prototype.js'></script>
<script type="text/javascript" src='~/CMSScripts/scriptaculous.js'></script>
<script type="text/javascript" src='~/CMSScripts/lightview.js'></script>

What am I doing wrong, or is there a better way to do this?

I am using PortalEngine and am on version 4.0 of Kentico CMS.

User avatar
Member
Member
kentico_pavelk - 3/31/2009 4:30:54 AM
   
RE:Where to put custom .js files?
Hi,

You may need to insert the tags to <project folder>\CMSPages\PortalTemplate.aspx. Could you please try it?


Best Regards,
Pavel Knotek

User avatar
Member
Member
ldowdell - 5/7/2012 10:30:44 AM
   
RE:Where to put custom .js files?
Im experiencing the same thing. I'm using 6.0 and ASPX pages. Where should I place the jquery files and where should I reference them?

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 5/8/2012 2:44:30 AM
   
RE:Where to put custom .js files?
Hello,

The files can be placed in the CMSScripts folder. You can reference them for example in the master page in the header.

Best regards,
Boris Pocatko

User avatar
Member
Member
ldowdell - 5/8/2012 8:41:49 AM
   
RE:Where to put custom .js files?
Thanks I'll try, however I have read in different forums folks trying to set the path to their script and been unsuccessful. If placed in the CMSScripts folder, what path should I use to reference it?

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 5/10/2012 6:02:42 AM
   
RE:Where to put custom .js files?
Hi,

in case of portal engine site you can insert link to the head section on the Master page tab.

For example:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"> </script>
<script type="text/javascript" src="~/CMSScripts/jquery/acordion/javascript.js"> </script>


If you use aspx templates you need to insert the code directly to your .master file, into its head section.

Best regards,
Ivana Tomanickova