Retrieve Table of Contents on Article page

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
Posts: 7
Joined: Sun Nov 07, 2010 10:01 am

Retrieve Table of Contents on Article page

Postby bgarnicnig » Mon May 13, 2013 4:01 pm

I'm trying to render the relevant Table of Contents on the article page (article.tpl), in an abbreviated version. I was wondering if any of you could help me find which variables/objects I could call to retrieve an array/object containing the ToC, similar to what happens in

Code: Select all

{foreach name=sections from=$publishedArticles item=section key=sectionId}

in templates/issue/issue.tpl

simply including

Code: Select all

{include file="issue/issue.tpl"}
doesnt seem to do the trick...


Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Re: Retrieve Table of Contents on Article page

Postby asmecher » Tue May 14, 2013 10:24 am

Hi Bernhard,

The problem is that the variables you're referencing in Smarty haven't been assigned by the PHP code that supports that template. The $publishedArticles variable is assigned for use in the issue template in pages/issue/; look at the code surrounding the line:

Code: Select all

$templateMgr->assign_by_ref('publishedArticles', $publishedArticles);
To get access to $publishedArticles in the article view, you'll have to expose that variable in the PHP code prepping the article template, which will be in pages/article/

Alec Smecher
Public Knowledge Project Team

Return to “OJS Development”

Who is online

Users browsing this forum: No registered users and 1 guest