bozana
July 31, 2017, 4:27pm
21
Hi @Tiziano and @digitojs
The keywords and subjects are not saved in the DB table submission_settings
in OJS 3. Now they are saved in the DB tables controlled_vocabs
, controlled_vocab_entries
and controlled_vocab_entry_settings
. Thus, you would also need to use another code to get them, something like:
$dao = DAORegistry::getDAO(‘SubmissionKeywordDAO’);
$keywords = $dao->getKeywords($articleId, arrayOfLocales);
$dao = DAORegistry::getDAO(‘SubmissionSubjectDAO’);
$subjects = $dao->getSubjects($articleId, arrayOfLocales);
S. also this issue and fix for the migration of keywords and subjects from 2.4.x to 3.x, that will be in the next OJS release: subject and subjectClass migration · Issue #2501 · pkp/pkp-lib · GitHub
Best,
Bozana
1 Like
Hi @bozana , thanks for this clarifications, this OJS is a little different from old version and i try to learn it.
For this modify i need more explains because the code that you wrote, where i can use it? In the classes page? Which?
Thanks for your support!
Bye
Tiziano
bozana
August 1, 2017, 9:44am
23
Hi @Tiziano
I see now that the keywords are already assigned to the template here: https://github.com/pkp/ojs/blob/master/pages/article/ArticleHandler.inc.php#L121-L123 .
If you would like to have the subjects displayed as well you would need to do the same for subjects.
Then you can add the code like this to your template article_details.tpl, e.g. here ojs/article_details.tpl at ojs-3_0_2-0 · pkp/ojs · GitHub :
{if !empty($keywords[$currentLocale])}
<div class="item keywords">
<h3 class="label">
{translate key="article.subject"}
</h3>
<p>
{foreach from=$keywords item=keyword}
{foreach name=keywords from=$keyword item=keywordItem}
{$keywordItem|escape}{if !$smarty.foreach.keywords.last}, {/if}
{/foreach}
{/foreach}
</p>
</div>
{/if}
S. also this post: Tag Cloud plugins OJS 3.0
And appropriately for subjects, if wished.
Best,
Bozana
Hi @bozana , great! Thanks for the help! I’ll study this code, for now i apply the same concept for the subjects, how you suggest me.
Bye
Tiziano
Hello @bozana and @Tiziano ,
the suggestions worked!
Thank you,
Best regards
Hey @bozana , that is great!
Is there a way to do something similar with the “supporting agencies” field? We would like to use it to display information about the research projects some articles are related to, into the article details.
Thank you!
Best,
Daniel
ICONO14
bozana
July 17, 2018, 9:30am
27
Hi @celuloide
You would need to add something like these code lines in the function view
in pages/article/ArticleHandler.inc.php
:
$submissionAgencyDao = DAORegistry::getDAO('SubmissionAgencyDAO');
$templateMgr->assign('agencies', $submissionAgencyDao->getAgencies($article->getId(), array(AppLocale::getLocale())));
And then add something like these code lines in the templates/frontend/objects/article_details.tpl
:
{if !empty($agencies[$currentLocale])}
<div class="item agencies">
<h3 class="label">
{translate key="submission.supportingAgencies"}
</h3>
<p>
{foreach from=$agencies item=agency}
{foreach name=agencies from=$agency item=agencyItem}
{$agencyItem|escape}{if !$smarty.foreach.agencies.last}, {/if}
{/foreach}
{/foreach}
</p>
</div>
{/if}
Best,
Bozana
1 Like
Awesome @bozana ! It works like a charm
Thousand thanks!
Daniel