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

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a technical support question, try the OJS Technical Support subforum.

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: 9071
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: 9071
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 2 guests