Hi, with almost 40 journals (https://riviste.unimi.it) we would like to have a A-Z line (like this Brands for Sale on Newegg.com) with each letter link to journals starting with it, to help user reaching journal starting with S, T ecc.
Does anyone has implemented something similar, or have hints to do it?
Best regards,
Stefano Bolelli Gallevi
Hi there,
I think it’s possible, but not without changing the theme. I thought about doing it myself for our website, but so far it wasn’t necessary (because we don’t wanto to show all our journals on the frontpage which are in this installation for different reasons).
First of all: Do you have access to your theme and can change it? It seems like a custom theme or child theme you’re using.
So, without testing it this is the way I would try it:
You would need to add something like ‘<div id=“M”>M</div>’ to the journal list for every letter. To add the letter only once you could take a look at journals who added the years to their archive (like https://journals.ub.uni-heidelberg.de/index.php/dco/issue/archive). We used this code in the issueArchive-template:
{if $issue->getYear() != $lastYear}
{$issue->getYear()|escape}
{assign var=lastYear value=$issue->getYear()}
{/if}
I think it could be adapted to you journal list.
Then you would have to assign the alphaList like in the old browse plugin (for authors).
$templateMgr->assign(array(
‘alphaList’ => array_merge(array(‘-’), explode(’ ', __(‘common.alphaList’))),
));
And then you have to add something like this to the top of your journal list:
{foreach from=$alphaList item=letter}<a href=“#{$letter”}">{$letter|escape} {/foreach}
Best regards
Daniela
Dear @UBWolf ,
thanks for your answer and sorry for delay in feedback.
Our site theme is an Immersion customisation, you can see it here.
Regarding your hints, I do not understand how you manage years to get letters, and wich php files have to be modified precisely. Part of your code (the years part) seems referred to each journal’s tpl files, so I think that has to be added to new journals when they are opened, correct?
I hope you can send more details, we have a test site so we can try your solution before applying in production.
We also thought a different solution: adding a custom field at journal level where storing the letter and some code to filter with a javascript. It would be quite simple, but I can’t find how to add custom files at journal level without managing the db directly… Have you any suggestion on this?
Waiting for your answer, best regards
Stefano
Yes, the years part referred to every journal, but can be changed for the index site.
So, basically you’ll want to add the indexSite.tpl to your theme and customize this (it’s the overview site template). Without testing it:
There you have the “iterate”-part.
{if $journal->getLocalizedName()|substr:0:1 != $firstletter}
<div id=“{$firstletter}”></div>
{assign var=firstletter value=$journal->getLocalizedName()|substr:0:1}
{/if}
That should add a div with the first letter as ID to the first journal with this letter.
Then you have to add
$templateMgr->assign(array(
‘alphaList’ => array_merge(array(’-’), explode(’ ', __(‘common.alphaList’))),
));
to ImmersionThemePlugin.inc.php
And then
{foreach from=$alphaList item=letter}<a href=“#{$letter”}">{$letter|escape} {/foreach}
at the beginning of your indexSite.tpl.
I don’t think you need a custom field.
Kind regards
Daniela
Hi @UBWolf, thank you very much for your help.
I modified templates/frontend/pages/indexSite.tpl, can you have a look?
Regarding NUimmersionThemePlugin.inc.php, the code goes into the init function or elsewere?
If goes to the init function, what about the end of it, between lines 89 and 90?
Sorry to bother you, I’m newby to PHP…
Best regards
Stefano
Hi @bolelligallevi,
personally I would add the A-Z above the journals in bloc 3, but that’s just personal preference. The indexSite.tpl also still needs the the IDs with the first letter, otherwise you don’t have an anchor for linking.
And yes, the code for the ThemePlugin.inc.php goes into the init function.
Kind regards
Daniela