OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Customizing Article view

Are you an Editor, Author, or Journal Manager in need of help? Want to talk to us about workflow issues? This is your forum.

Moderators: jmacgreg, michael, vgabler, John

Forum rules
This forum is meant for general questions about the usability of OJS from an everyday user's perspective: journal managers, authors, and editors are welcome to post questions here, as are librarians and other support staff. We welcome general questions about the role of OJS and how the workflow works, as well as specific function- or user-related questions.

What to do if you have general, workflow or usability questions about OJS:

1. Read the documentation. We've written documentation to cover from OJS basics to system administration and code development, and we encourage you to read it.

2. take a look at the tutorials. We will continue to add tutorials covering OJS basics as time goes on.

3. Post a question. Questions are always welcome here, but if it's a technical question you should probably post to the OJS Technical Support subforum; if you have a development question, try the OJS Development subforum.

Customizing Article view

Postby jge » Fri Jul 11, 2008 5:58 am

We plan to publish an open access philosophy review journal with OJS, articles will be shown as html files.
My problem: I want the navbar elements and the header element that are visible for readers on the main page of the journal to be visible as well in the article view. This is not the case 'out of the box'.
If I understand the system correctly there's no standard way to 'customize' the article view. So it seems to me I have to change the article.tpl manually in ojs/templates/article -- is that correct?

I tried to solve this with 'copy and paste' from the right sources. So this is what I have done:

I added
Code: Select all
   {call_hook|assign:"leftSidebarCode" name="Templates::Common::LeftSidebar"}
   {call_hook|assign:"rightSidebarCode" name="Templates::Common::RightSidebar"}
   {if $leftSidebarCode || $rightSidebarCode}<link rel="stylesheet" href="{$baseUrl}/styles/sidebar.css" type="text/css" />{/if}
   {if $leftSidebarCode}<link rel="stylesheet" href="{$baseUrl}/styles/leftSidebar.css" type="text/css" />{/if}
   {if $rightSidebarCode}<link rel="stylesheet" href="{$baseUrl}/styles/rightSidebar.css" type="text/css" />{/if}
   {if $leftSidebarCode && $rightSidebarCode}<link rel="stylesheet" href="{$baseUrl}/styles/bothSidebars.css" type="text/css" />{/if}

from the common/header.tpl header to the article.tpl header.

And I added two elements in the body section of the article.tpl:

First, directly after the <div id="container"> opening tag:
Code: Select all
<div id="header">
<div id="headerTitle">
<h1>
{if $displayPageHeaderLogo}
   <img src="{$publicFilesDir}/{$displayPageHeaderLogo.uploadName|escape:"url"}" width="{$displayPageHeaderLogo.width|escape}" height="{$displayPageHeaderLogo.height|escape}" style="border: 0;" alt="" />
{/if}
{if $displayPageHeaderTitle && is_array($displayPageHeaderTitle)}
   <img src="{$publicFilesDir}/{$displayPageHeaderTitle.uploadName|escape:"url"}" width="{$displayPageHeaderTitle.width|escape}" height="{$displayPageHeaderTitle.height|escape}" style="border: 0;" alt="" />
{elseif $displayPageHeaderTitle}
   {$displayPageHeaderTitle}
{elseif $alternatePageHeader}
   {$alternatePageHeader}
{elseif $siteTitle}
   {$siteTitle}
{else}
   {translate key="common.openJournalSystems"}
{/if}
</h1>
</div>
</div>


Second, directly after the <div id="body"> opening tag:
Code: Select all
{if $leftSidebarCode || $rightSidebarCode}
   <div id="sidebar">
      {if $leftSidebarCode}
         <div id="leftSidebar">
            {$leftSidebarCode}
         </div>
      {/if}
      {if $rightSidebarCode}
         <div id="rightSidebar">
            {$rightSidebarCode}
         </div>
      {/if}
   </div>
{/if}



And I deleted the following line directly after the <div id="main"> opening tag
Code: Select all
<h2>{$siteTitle|escape}{if $issue},&nbsp;{$issue->getIssueIdentification(false,true)|escape}{/if}</h2>


This seems to work, though I only tested it with one article. I want to know whether this is a good way or is there an easier and better way to do it?
jge
 
Posts: 3
Joined: Fri Jul 11, 2008 2:44 am

Re: Customizing Article view

Postby absulm » Mon Jul 14, 2008 1:54 pm

Hi,

I think that I am trying to achieve the same thing, but maybe not.

I want to display a html file with the headers and footers like on the OJS demonstration article at:

http://pkp.sfu.ca/ojs/demo/present/inde ... view/29/30

Is there an easy way to achieve this within OJS options without modifying the code (looks complex!)?

Regards,

Sean
absulm
 
Posts: 6
Joined: Sat Jun 14, 2008 2:14 pm

Re: Customizing Article view

Postby jmacgreg » Mon Jul 14, 2008 7:11 pm

Hi all,

@Sean: could you try reposting that link? The forum system broke it.

@jge: while I haven't tested what you've done here, it looks good to me. Typically, you can achieve good and reversible results by sticking to template changes. Just keep in mind that when it comes time to upgrade you will probably have to do a bit of work to merge your changes with any changes you've done to the template.

If you'd like to share screenshots of the results of your changes, by all means go ahead. We're always happy to see people adapting the code to their own ends.

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

Re: Customizing Article view

Postby jge » Tue Jul 15, 2008 3:55 am

Thanks for answering.
Here are two screenshots of the home page
kritikon_home.PNG
Journal home page, draft
kritikon_home.PNG (49.47 KiB) Viewed 1639 times


and the article view page
kritikon article view.PNG
Journal article view page, draft
kritikon article view.PNG (76.61 KiB) Viewed 1639 times


to demonstrate the effect of my changes.

I don't know why in the article view page the right navbar background of the forms is grey. Apart from that it seems to me that this has done the trick. I have not thought about the page footer yet.
jge
 
Posts: 3
Joined: Fri Jul 11, 2008 2:44 am

Re: Customizing Article view

Postby mcrider » Tue Jul 15, 2008 12:02 pm

Hi jge,

jge wrote:I don't know why in the article view page the right navbar background of the forms is grey. Apart from that it seems to me that this has done the trick. I have not thought about the page footer yet.

To remove the gray background for the form items in the article view pages, edit the css file located at OJSDIRECTORY/styles/articleView.css. Find the table selector at line 144, which looks like this:

Code: Select all
table {
   background-color: #F0F0E8;
}

... And comment out or delete the whole thing. Alternatively, change the hex color to something more preferable if you want to contrast the forms from the rest of the navigation menu.

Cheers,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: Customizing Article view

Postby jge » Wed Jul 16, 2008 2:46 am

Thanks Matt! You're right, and now the background is white as it should.
jge
 
Posts: 3
Joined: Fri Jul 11, 2008 2:44 am

Re: Customizing Article view

Postby fnovilla » Sun Jun 30, 2013 3:46 am

hello everyone. Im also trying to edit the whole look/lay-out of my OJS 2.4.2 installation. It took me a while to find what files to edit 'coz I am totally not knowledgeable of Smarty Template and I thought .tpl files are un-editable. anyways, i am re-positioning some <div> tags and Im trying to find the $rightSidebarCode location i found in ojs\lib\pkp\templates\common\header.tpl line 167, but to no avail i cant find it. I would like to edit the contents of the sidebar (e.g. insert images, external links, etc). PLEASE HELP.
fnovilla
 
Posts: 4
Joined: Fri Jun 28, 2013 7:09 pm

Re: Customizing Article view

Postby beuseful » Mon Jul 01, 2013 1:12 am

Do you know the Custom Block Manager Plugin? You'll find it when logging in as journal manager, go to the plug-in section and look up the generic plug-ins.
Here you'll find more information about this plug-in: viewtopic.php?f=28&t=3459
beuseful
 
Posts: 9
Joined: Mon Jan 14, 2013 8:36 am

Re: Customizing Article view

Postby fnovilla » Tue Jul 02, 2013 11:53 pm

yes. i know Custom Block Plugin. but that is not what i need. i want to add some links, edit some text in the side bar like the "You are logged in as...".
fnovilla
 
Posts: 4
Joined: Fri Jun 28, 2013 7:09 pm


Return to OJS Editorial Support and Discussion

Who is online

Users browsing this forum: No registered users and 1 guest