Load article issue in indexJournal.tpl (OJS 3.1.2.4)

Hi,

I use OldGregg theme in my journal and had made some customizations. I use {$issue->getTitle($locale)} to show article issue, but I have noticed that the current issue is always loaded in this string. I have tried a lot of different strings based on OJS API Reference but nothig solved my question. With {$article->getData(‘issueId’)} I can load article issue id, but can’t load issue title.

How can I load respective article issue in indexJournal.tpl file?

{foreach from=$publishedArticles item=article key=k}
...
{$issue->getTitle($locale)} // load current issue title, not the article issue title
{/foreach}

Hello @geniusdesign

I see this var

{if $issue->getLocalizedTitle()}
         {$issue->getLocalizedTitle()|escape}
....

are they useful for you?

Thanks

Thank you for your suggestion @juanito, but the result is the same. This var loads issue title from the current journal issue, not the article issue title. Var {$article->getData(‘issueId’)} gets article issue ID, but a triet to use {$article->getData(‘issueTitle’)}, for example, but doens’t work.

Maybe if was possible to get issue title from issueId {$article->getData(‘issueId’)}… I don’t know how to try it.

{$article->getLocalizedFullTitle()|escape}

???

@geniusdesign

What is “article issue title”?

Can you put an example? Thanks

Hi @geniusdesign,

You can get issue id from from an instance of a submission object ($publishedArticle) with following:

$publishedArticle->getCurrentPublication()->getData('issueId') 

Retrieving the issue title is trickier. I’d make this on the backend - call the IssueDAO::getById. Published articles are assigned in OldGreggThemePlugin::browseLatest, thus the issue object cab be assign to each article there, e.g., as a key of the associative array: iterate through published articles, retrieve issue object by id, assign it as a key where the value is correspondent submisison object.

1 Like

This var gets article title.

I guess I’m not expressing me very weel, sorry. Each article is atributed to an edition, right? This edition has some fields, as ID, volume, number, title, etc. I’d like to load the issue title from an article. Hope I had expressed better :slight_smile:

Hi @Vitaliy, thx for our help but I have no idea how can I write it. So, there is no var associated to an article that allows me to get issue title, right?

This var returns issue ID from published article and it’s not exactly what I need.

Yes. The issue title isn’t a part of the publication data, so you’ll need to use this id to retrieve the Issue object by IssueDAO::getById and then the issue title.

Not directly. For such modifications I’d write a child theme and make all modifications there.
From a child theme you can write a method that intercepts published articles from the index journal page, then, e.g., retrieve all issue objects associated with them by issue id, and assign them to the template. This requires some knowledge of PHP.

1 Like

Forgot to mention, that knowing issue id the Issue object can also be retrieved through API call. But that doesn’t make the task easier.

1 Like

Thank you @Vitaliy

I’ll try to solve it with a developer support, it’s not really simple.

:slight_smile: