Hi
For OJS version 3.3.0.7
I want to use getSectionTitle() function in article_summary.tpl to show the current article section Title along with each article but it does not return any value.
{$article->getSectionTitle()}
But if I use {$article->getSectionId()}, I am getting the section ID.
I found the following thread on this topic where the user has a similar issue but there is no solution.
I have also searched the database with the following query suggested by @Vitaliy
SELECT setting_value FROM section_settings WHERE section_id = '25' AND locale = 'en_US' AND setting_name = 'title'
and it returns the value. So section name is stored in the database.
I noticed that it was reported in GitHub here and is showing that the issue is successfully merged.
Does anyone have a suggestion here on how to pull the section name?
Thanks
Can you check where it fails, is it the method getLocalizedData('title') or section object retrival from DAO class $section = $sectionDao->getById($sectionId);?
It was failing at the $sectionDao->getById($sectionId); line because $sectionId was null.
I was able to get it to work but was not able to do so in the main theme class so couldn’t assign the values to Smarty for display in the template. In the article_card_horizontal.tpl file I used Smarty “assign” commands to grab the section titles by ID and that seems to work OK. I realise it’s probably not the recommended way of doing it but I wasn’t able to get it to work any other way.
I basically just inserted this code before the call to article_card_horizontal:
It’s just for a list of most recent articles in the home page. The section title was always blank (even in the array of articles). Prior to 3.3 this used to just work but it no longer does.