Organize archives

In “templates/frontend/pages/issueArchive.tpl” I put this code:

 * templates/frontend/pages/issueArchive.tpl
 * Copyright (c) 2014-2018 Simon Fraser University
 * Copyright (c) 2003-2018 John Willinsky
 * Distributed under the GNU GPL v2. 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}
			{url|assign:"prevUrl" router=$smarty.const.ROUTE_PAGE page="issue" op="archive" path=$prevPage}
		{elseif $prevPage === 1}
			{url|assign:"prevUrl" router=$smarty.const.ROUTE_PAGE page="issue" op="archive"}
		{if $nextPage}
			{url|assign:"nextUrl" router=$smarty.const.ROUTE_PAGE page="issue" op="archive" path=$nextPage}

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

But this happened:
template1 tempate2 templa3 temp4
Can you help me?

If I am reading this correctly, you have added:

into the {foreach from=$issues item="issue"}. This would seem reasonable to add a header within the list at the start of each year of backissues. I tested this successfully in a vanilla install of OJS 3.1.1-4.

Do you have any custom issue ordering in place? (See: Admin → Issues → Back Issues → Order). If the issues appear outside of date order in this list, you will need to reorder them into date order.

1 Like

I have already arranged the dates of some previous editions, now everything is correct. Thank you.