OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Article template: simplify

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.

Article template: simplify

Postby kellner » Tue Jan 20, 2009 1:08 pm

I am trying to simplify the article template: no frames, no frills, just the bibliographical data for the article, and if a PDF galley exists, a download link to the file that opens in the browser when the Acrobat plugin is installed or else opens whatever application the user has installed to handle PDF.

I managed to remove all the frames etc. code and now am stuck with some minor issues:

- page title: I want it to be just "Article information" and therefore included this in view.tpl:

{assign var=pageTitle value="Article information"}

Problem: it is displayed like this both in the header title and in the page heading:

##Article information##

Where do the sharps come from? And how can I get rid of them?

For the download link, I use this code:

<a href="{url page="article" op="download" path=$article->getBestArticleId($currentJournal)|to_array:$galley->getBestGalleyId($currentJournal)}" class="file" target="_parent">{$galley->getGalleyLabel()|escape}</a>

In my Firefox installation, a click pulls up the application chooser menu; it doesn't load the plugin. Any idea how I could make it do so?

Also, I can access the article title, author(s) and page numbers, but not the issue information. It seems that $issue is not available to this template - I'd appreciate suggestions as to how I can retrieve this data.

Finally, I was wondering how I could include links to citation formats like BibTeX (click opens up page that displays BibTeX record as plain text).

Thanks,
kellner
 
Posts: 39
Joined: Fri Apr 07, 2006 12:11 pm

Re: Article template: simplify

Postby jmacgreg » Tue Jan 20, 2009 6:43 pm

Hi Kellner,

I can answer some of these questions, and I'll pass the rest on to the developers:

- page title: I want it to be just "Article information" and therefore included this in view.tpl:

{assign var=pageTitle value="Article information"}

Problem: it is displayed like this both in the header title and in the page heading:

##Article information##

Where do the sharps come from? And how can I get rid of them?


Smarty is expecting you to pass it a locale key (locale keys are mostly stored in locale/en_US/locale.xml, although they are sometimes stored elsewhere, for example in plugin directories). If you put a message key and value in your locale file (something like <message key="article.title">Article Information</message>, you can then call it by passing it to a variable and then calling it when you need it. In this instance, your pageTitle value should match the message key "article.title".

(More information on locales and translating available in http://pkp.sfu.ca/files/docs/translating/index.html)

For the download link, I use this code:

<a href="{url page="article" op="download" path=$article->getBestArticleId($currentJournal)|to_array:$galley->getBestGalleyId($currentJournal)}" class="file" target="_parent">{$galley->getGalleyLabel()|escape}</a>

In my Firefox installation, a click pulls up the application chooser menu; it doesn't load the plugin. Any idea how I could make it do so?


Try changing the op value to "viewFile" instead of "download".

Also, I can access the article title, author(s) and page numbers, but not the issue information. It seems that $issue is not available to this template - I'd appreciate suggestions as to how I can retrieve this data.


Not sure about this one.

Finally, I was wondering how I could include links to citation formats like BibTeX (click opens up page that displays BibTeX record as plain text).


I'd recommend taking a close look at the RT template files, and seeing if you can replicate the BibTeX citation feature. Specifically, you will want to look at templates/rt/captureCite.tpl, which calls all of the available citation plugins (which are stored in plugins/citationFormats). You should be able to modify the Smarty code from captureCite.tpl to display only the BibTeX information by default.

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

Re: Article template: simplify

Postby mcrider » Tue Jan 20, 2009 7:47 pm

Hi Kellner,

Regarding
Also, I can access the article title, author(s) and page numbers, but not the issue information. It seems that $issue is not available to this template - I'd appreciate suggestions as to how I can retrieve this data.

You'll have to add the issue object to the template via the article view handler code located in pages/article/ArticleHandder.inc.php. You can do this by adding this code to the view() function (before $templateMgr->display() and after the $templateMgr variable is initialized):
Code: Select all
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issue =& $issueDao->getIssueByArticleId($this->getArticleId());
$templateMgr->assign_by_ref('issue', $issue);


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

Re: Article template: simplify

Postby kellner » Wed Jan 21, 2009 12:27 am

Thanks! The article title display works fine, and the PDF now loads as expected.

As for the modification to a php-file suggested by Matt: I noticed that, when I updated to 2.2.2 with a patch, the template modifications I did were preserved. But if another upgrade were performed, would a modification to a php-file in the pages-subdirectory also be preserved?

As for the citation plugins: I got the dropdown for the citation plugins from captureCite.tpl, but when I just paste it into article.pl, the dropdown list is empty. I looked through the various site administration options in the interface, but couldn't find a menu for configuring the list of citation formats - did I miss that?

Thanks again,
kellner
 
Posts: 39
Joined: Fri Apr 07, 2006 12:11 pm

Re: Article template: simplify

Postby jmacgreg » Wed Jan 21, 2009 11:54 am

Hi Kellner,

Using the patch upgrade method will conform to the behaviour of the patch tool -- you can find more information on how it handles modified files here: http://en.wikipedia.org/wiki/Patch_(Unix) and by typing 'man patch' or 'patch --help' on the command line. Generally speaking, if the lines no longer match up due to added/deleted text, it'll try to intelligently add the patch changes by looking for further context and will complain if it's fairly unsure.

Regarding the citation plugin: I'm not 100% sure but I think you're probably hitting the same issue that Matt provided a solution to previously -- those captureCite variables aren't available to the article set of pages by default (they are normally only used with the RT pages), so you'll have to modify articleHandler.inc.php to include the rt object (or captureCite, I'm honestly not sure).

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

Re: Article template: simplify

Postby kellner » Wed Jan 21, 2009 1:02 pm

Thanks again!

With a little more digging in CitationPlugin.inc.php, captureCite.tpl and the relevant citation.tpl files, I managed to achieve what I want.

For what it's worth:

I had to also add
Code: Select all
$templateMgr->assign_by_ref('journal',$journal)
;

to Article.inc.php, and then this code from CitationPlugin.inc.php:

Code: Select all
$citationPlugins =& PluginRegistry::loadCategory('citationFormats');
      uasort($citationPlugins, create_function('$a, $b', 'return strcmp($a->getDisplayName(), $b->getDisplayName());'));
      $templateMgr->assign_by_ref('citationPlugins', $citationPlugins);
      if (isset($citationPlugins[$citeType])) {
         // A citation type has been selected; display citation.
         $citationPlugin =& $citationPlugins[$citeType];
      } else {
         // No citation type chosen; choose a default off the top of the list.
         $citationPlugin = $citationPlugins[array_shift(array_keys($citationPlugins))];
      }
      $citationPlugin->cite($article, $issue);


The last line seems to be responsible for calling the citation templates. In the original setup, this called on captureCite.tpl, which contained the whole page code including header and footer. I removed all the necessary bits to article.tpl, deleted all the unnecessary ones, and now things are ok.

Example: http://www.istb.univie.ac.at/jiabs/inde ... tionPlugin

Some more twiddling with the individual plugins is called for, and some more formatting, but that's all.

Thanks again! You were all really helpful, and very fast at it, too!
kellner
 
Posts: 39
Joined: Fri Apr 07, 2006 12:11 pm

Re: Article template: simplify

Postby jmacgreg » Wed Jan 21, 2009 4:23 pm

Hey Kellner,

Thanks for getting back to us, and for posting your steps. Glad to hear it's working, and I'll be checking this out myself. :D

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


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 3 guests