I am trying to add a block with latest issues, and select from database, but couldn’t find the table for the Title of issue or journal, ?
Hi @get,
Content that’s localized (i.e. can be entered in multiple languages) is generally stored in a _settings
table, e.g. for issues
, it would be issue_settings
.
Regards,
Alec Smecher
Public Knowledge Project Team
Thank You Alec!
You are right i found it, for my purpose ( i want the 5 latest issues published in multi journal site, and after selecting volume , number , and connect with the issue_settings table with issue_id to get the issue title, it returns empty for some volume, and since its urgent , i thought the template way might have already prepared variables $title, $issueseries …but how to achieve iterating the last 5 issues?) Kind regards,
Hi @get,
I’m not sure I’m following the question. Can you describe it again in more detail? What version of OJS are you working with?
Regards,
Alec Smecher
Public Knowledge Project Team
I am using ojs 3.0.2 version. It is multi-site journal and i wanted to display the five latest issues published, vol,nor,year and title.
regards
This is the code I use in Journal.fi front page. I have a custom theme for the front page and this is in the main theme file. You will of course need a corresponding front page template that will show the assigned variable.
// Start Latest issues
$issues = array();
$issueList = array();
$volLabel = __('issue.vol');
$numLabel = __('issue.no');
// show the latest published and open access issues
$result = $issueDao->retrieve("SELECT issue_id FROM issues WHERE published = '1' AND access_status= '1' AND year != '0' ORDER BY date_published DESC LIMIT 6");
while (!$result->EOF) {
$resultRow = $result->GetRowAssoc(false);
$issues[$resultRow['issue_id']] = $issueDao->getById($resultRow['issue_id']);
$result->MoveNext();
}
$result->Close();
foreach($issues as $issueId => $issue){
# Get the localized journal name and journal path
$journal = $journalDao->getById($issue->getJournalId());
$issueList[$issueId]['journal'] = $journal->getLocalizedName();
$issueList[$issueId]['journalPath'] = $journal->getPath();
# Get the issue cover or use default image
if ($issue->getLocalizedCoverImageUrl()){
$issueList[$issueId]['cover'] = $issue->getLocalizedCoverImageUrl();
$issueList[$issueId]['contain'] = true;
}
else{
$issueList[$issueId]['cover'] = $request->getBaseUrl()."/plugins/themes/themename/images/default_cover.png";
}
# Get issue path
$issueList[$issueId]['path'] = $issue->getBestIssueId();
# Get issue identification
$volume = $issue->getVolume();
$number = $issue->getNumber();
$year = $issue->getyear();
$issueIdentification = "";
if ($year != "") $issueIdentification = "(".$year.")".$issueIdentification;
if ($number != "0") $issueIdentification = $numLabel." ".$number." ".$issueIdentification;
if ($volume != "0") $issueIdentification = $volLabel." ".$volume." ".$issueIdentification;
$issueList[$issueId]['identification'] = $issueIdentification;
}
// assign listing to the smarty template
$templateMgr->assign('issueList', $issueList);
// End Latest issues
Edit: happy to hear if this could be made simpler. I am thinking two parts a) the query and b) the issue identification parsing.
Edit2: the way I use this is that I have this in the theme init function:
public function init() { HookRegistry::register ('TemplateManager::display', array($this, 'loadTemplateData'));
And the code snippet above is inside the loadTemplateData function.
Hi,
How can i access an issue (any one, not just the $issue) by its number?
I’m trying to access it on the issue_toc.tpl file but it is not working.
I tryied your code and its generating error 500 here.
Any hint?
I m using ojs 3.01
Thks
Well you could
$issueDao = DAORegistry::getDAO(‘IssueDAO’);
$issues = $issueDao->getPublishedIssuesByNumber($journal->getId(), $volume, $number, $year);
Then pass the data to the needed template https://pkp.gitbooks.io/pkp-theming-guide/content/en/advanced-custom-data.html
Dear @ajnyga and others,
I tried this code to show current issue, and a specific issue (advance access) on the front page of in OJS3.1.2-1 with bootstrap3 theme, but it does not work. I could get the issue description and the published date of the second issue, but when I tell indexJournal.tpl
to call the /objects/issue_toc.tpl
file, the current issue articles are shown instead. Is this due to that $publishedArticles is not directly related to $issue? Do I need to add $publishedArticles as well to the template?