Override Templates

I’m trying create a theme for OJS. Is possible customize the native templates from my new theme?
I tried create the following folder structure:

MyTheme
----- templates
------- admin
---------- index.tpl

And:

MyTheme
------- admin
---------- index.tpl

Unsuccessfully, what the correct way to do?

Hi @Angelo_Rocha,

That’ll be possible exactly as you describe starting with OJS 3.0 and OMP 1.2, but for OJS 2.x, you’ll need to do a little more coding. Have a look at the referral plugin for how it overrides templates using the TemplateManager::… hooks; it’s in plugins/generic/referral/ReferralPlugin.inc.php.

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks @asmecher
When will release of version 3?

Hi @Angelo_Rocha,

We’re releasing a beta this summer, and will schedule the final release at that point.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Good news! I hope develope many themes and free themes for OJS.

Hi @Angelo_Rocha,

One of our main goals with OJS 3.0 was to overhaul and improve the front end, making it easier to write and maintain themes. I hope you’ll be pleasantly surprised.

Regards,
Alec Smecher
Public Knowledge Project Team

2 Likes

Waiting release of OJS 3.0

Hi @asmecher,

Would you mind expanding upon the technique to override templates in OJS 2 themes? I had a look at the referral plugin but couldn’t work out how to apply it to my own theme. Is it an actual override or can you only change variables ie. can HTML be added/removed/changed or not? Would there be a tutorial anywhere I could follow?
I have a theme working but I would like to be able to rearrange things a little.
And one specific question - is it possible to do something like move the Citation Format plugin output HTML to the Article HTML? (I could do it with absolute positioning but that’s pretty hacky and bad practice).
We will be upgrading to OJS 3 at some point but I have a deadline to get this done soon.

Thanks very much for your help.
Gary

See How to modify a theme without change core files? [OJS 2.4.8-1] - #2 by ajnyga

1 Like

Thanks @ajnyga ! Fantastic, that works! Very much appreciated!

Cheers,
Gary