Hello Matt,
Thanks for your response. I've spent a while double-checking over my goal and how I had thought to reach it. Concerning the key, you're right that I wouldn't get any useful information, in that I wouldn't be able to use the key for any flow control after the fact anyway (since it's already in smarty by that time). The other hand is much more interesting. The important piece of information I was looking for was not the contents of the issue itself, but the
order of the particular issues within the Issues object.
Here's my conundrum:
- Code: Select all
$publishedIssuesIterator =
$issueDao->getPublishedIssues($journal->getJournalId(), $rangeInfo);
$templateMgr->assign_by_ref('issues', $publishedIssuesIterator);
The archives.tpl uses the "issues" object to iterate through and print links to all of the published issues, which happen to be in the order of publication (otherwise they would return on the page in an indeterminate order). The unexpected thing I found was that using {debug} or "print_r($issues)", the $Issues object only seemed to contain one issue. That's perplexing to me.
Context / Purpose:
My client wanted to customize their OJS instance to add the "second most recent issue" of the journal to the home page. It's clear that the HCID benefit is dubious at best, but I wanted to try to fulfill their request. The "current" issue of the journal is flagged in the database. In order to determine the "second most recent issue" some calculations based on database values would be necessary. Rather than making this calculation, I'd thought to borrow the $Issues object used in creating the archives listing (since in that list, the database calculations have already been made). If (to make a simple analogy) the $Issues object were an array, the current issue would be index "0" and the second most recent would be index "1". I'd thought that there would be a way to access the "second most recent issue" from the archive's $Issues object in a similar way.
But again, it seems that even though the $Issues object is used to display a listing for the issues on the archives page, any snapshot of the contents of the $Issues object seems only to show one issue.
My questions would be:
1) Does the $Issues object actually contain all (or all published?) issues in the journal?
2) If so, why do {debug} and print_r($Issues) only show one issue?
3) If not, I don't understand at all how the archives page is getting it's link listings.
I'm thinking it'll be a simpler solution to just calculate on my own what the "second most recent" issue of the journal is, but I'm still very interested in what is happening with the $Issues object (if for no other reason than to become more familiar with "OO" php, smarty, and OJS.
Any time you or any other PKP devs/users would have to respond would certainly be appreciated

- Patrick E.
Patrick K. Étienne
Systems Analyst
Digital Library Development
Library and Information Center
Georgia Institute of Technology