[SOLVED] Customize the search template to display the year, volume and number instead of page numbers

How to access from the template article_summary.tpl to the functions of $issue class? Since template templates/frontend/objects/article_summary.tpl is also used for displaying the tables of contents of a numbers I created a new template templates/frontend/objects/article_search_summary.tpl and replaced in templates/frontend/pages/search.tpl:

{include file="frontend/objects/article_summary.tpl" article=$result.publishedArticle journal=$result.journal showDatePublished=true hideGalleys=true}

with

{include file="frontend/objects/article_search_summary.tpl" article=$result.publishedArticle journal=$result.journal showDatePublished=true hideGalleys=true}

Now I want to access the year, the volume and the article publication number in the article_search_summary.tpl, so that this info will be displayed instead of the page numbers.

In the templates/frontend/objects/article_details.tpl template, I saw how to access this information through the function {$issue->getIssueIdentification()}. However, access to this function is disabled from article_summary.tpl.

Maybe someone will tell me how (in a template) to know the article Id in which issue it was published?

Hi @crosfield,

Off the top of my head, you should be able to access $result.issue in templates/frontend/pages/search.tpl and provide it to your included template by adding something like…

issue=$result.issue

…to the {include ...} statement. Then in your article_search_summary.tpl you’ll have access to the $issue object.

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you @asmecher! The fact that at the top of your head was an absolutely accurate hit in the target goal :slight_smile:

1 Like

Hi @crosfield !

I’m trying to do what you did…

Is it possible to you to share your article_search_summary.tpl?

Thank you very much!

Kind regards,

Rui