[OJS 3.2.0.1] Help for statistics and corresponding author code

Hi everyone, I need help with a couple of things about the latest version of OJS, precisely in the article_details.tpl file I applied some codes that highlighted the corresponding author by displaying the email inserted in the metadata and another code that showed me the PDF downloads of the article.

This is the code for corrisponding authors:

{$author->getFullName()|escape}
{assign var=primary value=$author->getPrimaryContact()}
{if $primary} | {mailto address=$author->getEmail()|escape}{/if}

This is the code for the PDF downloads:

{if is_a($article, ‘PublishedArticle’)}{assign var=galleys value=$article->getGalleys()}{/if}
{if $galleys}
{foreach from=$galleys item=galley name=galleyList}
{$galley->getGalleyLabel()}: {$galley->getViews()}
{/foreach}
{/if}

in both cases it doesn’t show me anything anymore. Has anything changed?
Thanks for your help

Bye
Tiziano

Hi @Tiziano,

See the information on publications in OJS 3.2 here:

https://docs.pkp.sfu.ca/dev/release-notebooks/en/3.2-release-notebook

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,
I banged my head on it a little bit and I found the solution for the first part of the problem, I copy it here so it can be useful to someone else if you want. To view the corresponding author of an article:

{assign var=primary value=$publication->getData(‘primaryContactId’)}
{if $primary == $author->getId()}
{mailto address=$author->getEmail()|escape}
{/if}

now let’s see if we can find a solution to show the PDF downloads.

Bye
Tiziano

2 Likes

Hi @asmecher,
ok there should be, to view PDF downloads and galleys:

{foreach from=$article->getGalleys() item=galley}
{$galley->getGalleyLabel()}: {$galley->getViews()}
{/foreach}

Thanks for the support!
Bye
Tiziano

Great work indeed. Can you please tell me where exactly to place this code in article_details.tpl.
Thanks

Hi @seisense,
you can insert it wherever you want in the page, personally I have inserted it in the right column in the information.

example:
https://www.ejh.it/index.php/ejh/article/view/3109

Bye
Tiziano

Thanks @Tiziano
But when i inserted a code as below, article details page is giving error.

<div class="main_entry">

		{if $publication->getData('authors')}
			<section class="item authors">
				<h2 class="pkp_screen_reader">{translate key="article.authors"}</h2>
				<ul class="authors">
				{foreach from=$publication->getData('authors') item=author}
					<li>
						<span class="name">
							{$author->getFullName()|escape}
			{assign var=primary value=$publication->getData(‘primaryContactId’)}
                            {if $primary == $author->getId()}
                            {mailto address=$author->getEmail()|escape}
                            {/if}
						</span>
						{if $author->getLocalizedData('affiliation')}
							<span class="affiliation">
								{$author->getLocalizedData('affiliation')|escape}
							</span>
						{/if}
						{if $author->getData('orcid')}
							<span class="orcid">
								{$orcidIcon}
								<a href="{$author->getData('orcid')|escape}" target="_blank">
									{$author->getData('orcid')|escape}
								</a>
							</span>
						{/if}
					</li>
				{/foreach}
				</ul>
			</section>
		{/if}  

Sorry for my little knowledge of coding.
and thanks

Hi @seisense , wait but in which version of OJS do you want to implement the code?

I am using ojs 3.2.0-1

Hi @seisense,
to view the corresponding:

{foreach from=$publication->getData(‘authors’) item=author}
{$author->getFullName()|escape}
{assign var=primary value=$publication->getData(‘primaryContactId’)}
{if $primary == $author->getId()}
{mailto address=$author->getEmail()|escape}
{/if}

1 Like