[OJS 3] Archives -- Group by Year

ojs3
ojs
#21

It’s really interesting, thanks!
Would you be so kind to make a plugin out of it?

1 Like

#22

I’m sorry. I don’t think i have enough expirience.

0 Likes

#23

Hi, is it possible to add accordion syle in it? I tried doing it but it only showed one issue from the year (as it has foreach code).

0 Likes

#24

that would require javascript of some sort probably.

https://jqueryui.com/accordion/

I think jqueryui is loaded by default in OJS, not sure of frontend though.

0 Likes

#25

Hi, guys!

I have this code:

{**

  • templates/frontend/pages/issueArchive.tpl
  • Copyright © 2014-2018 Simon Fraser University
  • Copyright © 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}
    {else}
    {translate key=“archive.archives”}
    {/if}
    {/capture}
    {include file=“frontend/components/header.tpl” pageTitleTranslated=$pageTitle}
<div class="page-header page-archives-header">
	<h1>{$pageTitle}</h1>
</div>

{* No issues have been published *}
{if empty($issues)}
	<div class="row">
		<div class="col-md-8">
			<p>{translate key="current.noCurrentIssueDesc"}</p>
		</div>
	</div>

{* List issues *}
{else}
	{foreach from=$issues item="issue" key="i"}
		{if $i % 4 == 0 && $i > 0}
			</div>
			{assign var="open" value=false}
		{/if}
		{if $i % 4 == 0}
			<div class="row justify-content-around">
			{assign var="open" value=true}
		{/if}
		<div class="col-md-3 col-lg-2">
			{include file="frontend/objects/issue_summary.tpl" heading="h2"}
		</div>
	{/foreach}
	{if $open}
		</div>{* Close an open row *}
	{/if}

	{* Pagination *}
	{capture assign="prevUrl"}
		{if $prevPage > 1}
			{url router=$smarty.const.ROUTE_PAGE page="issue" op="archive" path=$prevPage}
		{elseif $prevPage === 1}
			{url router=$smarty.const.ROUTE_PAGE page="issue" op="archive"}
		{/if}
	{/capture}
	{capture assign="nextUrl"}
		{if $nextPage}
			{url router=$smarty.const.ROUTE_PAGE page="issue" op="archive" path=$nextPage}
		{/if}
	{/capture}
	{include
		file="frontend/components/pagination.tpl"
		prevUrl=$prevUrl|trim
		nextUrl=$nextUrl|trim
		showingStart=$showingStart
		showingEnd=$showingEnd
		total=$total
	}
{/if}

{include file=“frontend/components/footer.tpl”}

Please, help me to do group by year!

0 Likes