OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Simple Jquery script - how?

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

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.

Simple Jquery script - how?

Postby Looted » Sun Nov 03, 2013 1:37 pm

Hello!
I have a simple question - how to add a simple jquery script, that expands/collapses bibliography when clicked? I tried adding a simple script to the article template, but it doesn't seem to work (that is, the script is should definetly work as it is an example from jquery site), so I'm assuming it's an OJS thing?
Anyone had any success adding a simple jQuery scripts?
Cheers,
Looted
Looted
 
Posts: 18
Joined: Tue Oct 29, 2013 10:06 am

Re: Simple Jquery script - how?

Postby asmecher » Sun Nov 03, 2013 10:58 pm

Hi Looted,

I suspect you're running into a bit of overlap between Smarty syntax (we use the Smarty templating engine for OJS templates) and Javascript syntax. Smarty uses { and } for its own purposes, and those are often used in Javascript, which causes confusion -- Smarty tries to interpret them, can't, and then strips them out before they get to the viewer's web browser for the Javascript to be interpreted. Use {ldelim} and {rdelim} instead of { and } (respectively), or wrap the whole block in {literal}...{/literal} tags. Smarty's documentation covers these fully; see http://www.smarty.net.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Re: Simple Jquery script - how?

Postby Looted » Mon Nov 04, 2013 1:25 pm

That seemed to be the case, with the {literal} tag I was able to get some jQuery scripts working. Thank you for the time you took to anwser me Alec; I know I'm asking about trivial stuff. I'm responsible for migrating a journal to OJS, and I got pretty overwhelmed with everything (normally I would just sit at it until i figured it out, but at the moment, time is working againts me).
Cheers!
Looted
 
Posts: 18
Joined: Tue Oct 29, 2013 10:06 am

Re: Simple Jquery script - how?

Postby asmecher » Mon Nov 04, 2013 1:42 pm

Hi Looted,

No problem! Good luck with the work.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Development

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest