Using APA citation plugin in customized article page

Hi, I want to show how to cite the article directly from the article view (without the reading tools), and I am getting the citation in this way:

$this->pluginApa = & PluginRegistry::loadPlugin(‘citationFormats’, ‘apa’);
$citation = $this->pluginApa->fetchCitation($pubArticle, $issue, $this->journal);

It return the citation in apa format, but it is incomplete, because there is no url after the Retrieved from, I am missing something?

Hi @cccaballero,

You’re almost all the way there. The citation format plugins don’t have a particularly clean API for uses outside the reading tools, so you’ll need to do something like…

$templateMgr =& TemplateManager::getManager($request);
$templateMgr->assign('articleUrl', $request->url(null, 'article', 'view', $pubArticle->getBestArticleId($this->journal));

Then include your code just below that. (That’s not tested, but should be pretty close to correct.)

When we get to implementing this feature for OJS 3.0, we’ll do a cleaner job and probably use a third-party citation format repository like CSL.

Alec Smecher
Public Knowledge Project Team