Including javascript in header

Are you responsible for making OCS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, michael, John

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
acmajeed
Posts: 2
Joined: Mon Mar 11, 2013 2:35 am

Including javascript in header

Postby acmajeed » Mon Mar 11, 2013 2:42 am

Hello,
I am having some trouble getting to include external javascript in the header
After some trial and error I found that including the script in
/lib/pkp/templates/common/header.tpl

works.
However I notice that the variables are being stripped off from the including script. For eg I need to include the script below

Code: Select all

<script type="text/javascript">var notifyBarWidget = new NotifySnack();notifyBarWidget.init({hash:"ntm8ri9"});</script>


But the systems seems to strip off the

Code: Select all

 {hash:"ntm8ri9"}
bit.
Is there any way to get round this

Many thanks in advance
Ash

asmecher
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm
Contact:

Re: Including javascript in header

Postby asmecher » Mon Mar 11, 2013 8:24 am

Hi Ash,

In Smarty templates, you'll need to escape { and } characters e.g. using {ldelim} and {rdelim} instead. See the Smarty documentation at http://smarty.net.

Regards,
Alec Smecher
Public Knowledge Project Team

acmajeed
Posts: 2
Joined: Mon Mar 11, 2013 2:35 am

Re: Including javascript in header

Postby acmajeed » Mon Mar 11, 2013 8:49 am

wow. Fantastic. thanks a lot !
Ash


Return to “OCS Technical Support”

Who is online

Users browsing this forum: No registered users and 1 guest