Group archive issues by year (as in OJS3)

Hi @NateWr
I want to show archives issues by year either in menu or in sidebar.
I have seen this & tried but it’s not working .

Can you help me to resolve this issue. Looking forward.

I am using
OJS 3.2.0-3

Thanks & Regards

Hi @waqar,

Can you share the code you’re using in your issueArchive.tpl file?

Hi @NateWr Thanks for reply.
actually I want to group like this
Currently I have this code in issueArchive.tpl.

 * templates/frontend/pages/issueArchive.tpl
 * Copyright (c) 2014-2020 Simon Fraser University
 * Copyright (c) 2003-2020 John Willinsky
 * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
 * @brief Display a list of recent issues.
 * @uses $issues Array Collection of issues to display
 * @uses $prevPage int The previous page number
 * @uses $nextPage int The next page number
 * @uses $showingStart int The number of the first item on this page
 * @uses $showingEnd int The number of the last item on this page
 * @uses $total int Count of all published monographs
{capture assign="pageTitle"}
	{if $prevPage}
		{translate key="archive.archivesPageNumber" pageNumber=$prevPage+1}
		{translate key="archive.archives"}
{include file="frontend/components/header.tpl" pageTitleTranslated=$pageTitle}

<div class="page page_issue_archive">
	{include file="frontend/components/breadcrumbs.tpl" currentTitle=$pageTitle}

	{* No issues have been published *}
	{if empty($issues)}
		<p>{translate key="current.noCurrentIssueDesc"}</p>

	{* List issues *}
		<ul class="issues_archive">
	  	{foreach from=$issues item="issue"}
	  		{if $issue->getYear() != $lastYear}
	  			{assign var=lastYear value=$issue->getYear()}
	  			{include file="frontend/objects/issue_summary.tpl"}

		{* Pagination *}
		{if $prevPage > 1}
			{capture assign=prevUrl}{url router=$smarty.const.ROUTE_PAGE page="issue" op="archive" path=$prevPage}{/capture}
		{elseif $prevPage === 1}
			{capture assign=prevUrl}{url router=$smarty.const.ROUTE_PAGE page="issue" op="archive"}{/capture}
		{if $nextPage}
			{capture assign=nextUrl}{url router=$smarty.const.ROUTE_PAGE page="issue" op="archive" path=$nextPage}{/capture}

{include file="frontend/components/footer.tpl"}

That looks right to me. One thing is that the {assign} smarty tag has been removed. I can’t remember precisely which version of OJS we upgraded smarty in, but replace this line:

{assign var=lastYear value=$issue->getYear()}

With this:

{capture assign="lastYear"}{$issue->getYear()}{/capture}

Thanks again.

I have seen an example of collapse side bar of archives group by year.
How I can make such like that.

That would take more work and is beyond the scope of support I can offer. The issue archives page is paginated, which means you won’t have access to all issues in one template, and there’s no URL you can go to to view only issues for that year.

In order to accomplish what you want you’d need to load the full list of issues into the template. The theming guide provides some information about passing data to a template.

I noticed that the example you linked to in your last post puts a block in the sidebar. If that’s what you want to do, you probably want to create a block plugin. The plugin guide has a brief description of how block plugins.

but I required help to make block plugin. I have seen documentation but that is not enough for me to do. So give me a favor for this.

The easiest thing to do is probably to copy an existing block plugin. The makeSubmission block plugin is the simplest one.