I would like to add a specific id to each section in an issue’s toc (issue_toc.tpl). Our first goal is to style each section in a different way, our second goal is to include anchor links. But clearly the id is not part of the information which is passed to the template:
I can’t add something like {$section.id}, because it won’t be recognized. So I guess I have to change something in the PHP-Files
I’m working with a child theme, I could add some lines to the PHP-File there. Could you give me some directions?
Please be sure to be explicit about what versions and files you’re working with. This helps both those of us offering answers and helps other users to understand the context when reading the forum later.
I think you’re looking at OJS 3.x, specifically the issue_toc template (e.g. from master):
The $publishedArticles variable is populated here:
This points us to:
The index for the returned $publishedArticles variable is $currSectionId. If this is not directly accessible in Smarty, it could be added here for later use.
I strongly support this as an upstream contribution.
you are so right, of course I am working on 3.1.0.0 and I am using a duplicate of the issue_toc.tpl, which is included in my child theme, which is based on the default theme.
With your help I finally found a solution and I happily share it with you
If you don’t mind, please open an issue and pull request on Github for this. I think we should be adding ids and classes to everything we can in the core product.
I don’t see the actual commit in the pull request. Let’s say you are currently looking at branch ‘ojs-stable-3_0_1’ and it is the HEAD commit of “abc1234”. Let’s also assume you have remotes of origin and upstream, representing your repo and the pkp repos, respectively. You could: