You are viewing the PKP Support Forum | PKP Home Wiki

Changing template (vertical navbar)

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

Moderators: jmacgreg, michael

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.

Changing template (vertical navbar)

Postby miguelakira » Tue Feb 08, 2011 7:12 pm

Hello everyone.

I'm trying to change the template of OJS, but it's a much more difficult task than I thought it would be. I thought that only changing a few CSS files and a 'default.ctp' like file (as it is in cakephp) and I would be done.

Basically, I just want to change the navbar from horizontal to vertical style (as in http://campusvirtual.unex.es/cala/editio/ ) and show every issue of a magazine in the right sidebar.

But I don't get the logic of it. I can see the header.tpl, footer.tpl etc, but where is the 'main' file that calls them?

everything else would remain the same.

Is there a relatively easy way to do this?

Posts: 4
Joined: Tue Feb 08, 2011 6:57 pm

Re: Changing template (vertical navbar)

Postby jmacgreg » Thu Feb 10, 2011 10:29 pm

Hi miguelakira,

I'm assuming that you are using a more recent version of OJS (the following instructions wouldn't apply to versions before 2.3.0.) Also, you will want to take a look at the documentation at http://smarty.net. OJS uses the Smarty template engine, and thankfully they keep very good documentation.

Here's how I would do things:

1. Remove the top navigation bar. you can do this easily enough by removing the line that calls the navbar template file from lib/pkp/templates/common/header.tpl:

Code: Select all
{include file="common/navbar.tpl"}

If you want, you don't even need to delete the line. Just comment it out.

2. Create a block plugin. All sidebar content is delivered by [url=http://pkp.sfu.ca/ojs/docs/userguide/2.3.3/journalManagementBlockPlugins.htmlblock plugins[/url]. You can move block plugins to the right or left of your page in Journal Setup Step 5, so if you make a navbar block plugin you can then move it to the left. There is information on how to make block plugins [url=http://pkp.sfu.ca/wiki/index.php/Writing_a_Block_Plugin]here[/url], and you should also look at the plugins that are in plugins/blocks/ for examples of what to do.

3. Add the navbar code to the block plugin and edit it until it looks right. Basically, just take the template code you want from templates/common/navbar.tpl and add it to the block plugin. You'll want to change some things to get it to display how you want, and you can even add more stuff in there. It should be fairly easy to do if you take a look at the smarty documentation.

You can follow these general steps to also show an issue listing of the magazine in your sidebar -- basically, create another block plugin, but this time add the code that will grab issue information (title, link to the ToC, etc.) and display it. You may want to look at templates/issue/archive.tpl, which creates the journal's Archive page, for tips on how to do this.

If you have any further questions, just let us know.

Posts: 4191
Joined: Tue Feb 14, 2006 10:50 am

Return to OCS Development

Who is online

Users browsing this forum: No registered users and 1 guest