OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Templates and Scripts in OJS 2.2.2

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.

Templates and Scripts in OJS 2.2.2

Postby hekutoru2kx » Wed Jul 28, 2010 1:05 pm

Greeting everyone! I recently started to work in the journal department of my university and they use the OJS 2.2.2 to handle the journals. The thing is, they want to make some changes in the structure of the site and journals but no one there know how to do it. That's why I'm here :(.


I had read some of other topics to learn more about how it works and to know how and what to ask exactly. I need to add some scripts in the structure of some places, like the index page, journals, and some articles. The script i need to add right now is the Google Analytics script.

1.- Is there a way to know the exact structure of the templates? I know is different in 2.2 and 2.3 versions. I suposse the common handles the entire place, the article just an article, and rt for reading tools. But i couldn't find the journal place exactly.

2.- I add the script in the template/common/header.tpl, supossing that was the path for general pages. But it returned an error, something like "error in line x (something with var) and something with smarty". I was reading about it, and what i could know was it was a problem with some php - html difference in the handle of the ojs.

3.- I tryed the script in a blogger and it worked perfectly.

I wait for your response ;), thanx

PD: I apologize if i make some mistakes in the language, but i still have problems with my english ;).
PD2: this is the google analytics script

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-17694522-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
hekutoru2kx
 
Posts: 71
Joined: Wed Jul 28, 2010 12:47 pm

Re: Templates and Scripts in OJS 2.2.2

Postby hekutoru2kx » Wed Jul 28, 2010 4:04 pm

Well, i think i'm a step closer to the solution. Reading a lot more, i realize the thing is about static and dynamic pages. In other words, the script i was adding is a static one. Google Analytics also shows the script for dynamic server (php).

http://www.google.com/support/analytics ... swer=55504

It shows the page without problems... I'll just wait and post the results later...

I still have the doubt of the templates ;). Thx anyway :P
hekutoru2kx
 
Posts: 71
Joined: Wed Jul 28, 2010 12:47 pm

Re: Templates and Scripts in OJS 2.2.2

Postby jmacgreg » Thu Jul 29, 2010 3:58 pm

Hi hekutoru2kx,

Recent versions of OJS actually include a Google Analytics plugin, available under Journal Management -> System Plugins -> Generic Plugins. I don't recall exactly when it was added, but it may be in your install. If not, you can get it by upgrading to a more recent version of OJS (eg. 2.2.4 or 2.3.1-2), which definitely include the plugin. Probably a better option than hard-coding the GA script into the footer. :D

Cheers,
James
jmacgreg
 
Posts: 4190
Joined: Tue Feb 14, 2006 10:50 am

Re: Templates and Scripts in OJS 2.2.2

Postby hekutoru2kx » Tue Aug 03, 2010 8:51 am

Thx 4 your reply James...

I couldn't find the place you're talking. I checked the help and it says something similar, i also checked the psychal files and the plugins/generic/googleAnalytics folder exist in it.

I access to Home>User>Site Administration but only have the options below
Site Management
* » Site Settings
* » Hosted Journals
* » Languages
* » Authentication Sources

Administrative Functions
* » System Information
* » Expire User Sessions
* » Clear Data Caches
* » Clear Template Cache
* » Merge Users

But i can't get to the plugins configuration. The options in "site settings" refers only to title and descriptions.

I'm making it work in the code like i said in the previous post. But it sure will be really handy if it's attached to the plugin. If you can point me a lil more I'll be grateful. Maybe also the direct address (if it is common in versions) could be handy ;).

I won't like to update yet 'cuz there has been to many changes in the structure version and I'm afraid I could loose something and that also depends of my superiors. I know I'll have to do it sooner or later, 'cuz I exported the ojs to my PC and it shows a lot of deprecated instructions with the last version of XAMPP (Apache).
hekutoru2kx
 
Posts: 71
Joined: Wed Jul 28, 2010 12:47 pm

Re: Templates and Scripts in OJS 2.2.2

Postby hekutoru2kx » Tue Aug 03, 2010 9:09 am

Ok. Once again i found the problem :P. I was testing in a ojs without journals created. I found it already. But, that only means that i need to enable it for every journal the page has. I will look deeper in the forum to know how the plugin works. If I don't find anything else, I'll open an specific topic about it ;). Thx 4 your help.

I think I'm already done with the scripts handling in OJS :P. But I still have to learn about the complete structure of the ojs, and the templates. In that way I could think in updating to the last version of the OJS.
hekutoru2kx
 
Posts: 71
Joined: Wed Jul 28, 2010 12:47 pm


Return to OJS Development

Who is online

Users browsing this forum: Exabot [Bot], mbria, meinbrodt and 2 guests