Question regarding template variables

I have noticed that some template variables are only available to some templates, and not all. In particular, the $issue variable that holds details of the latest issue, is not being populated on all pages.

As I’m using the latest issue value in the main menu, it needs to be present for all page templates, so I am populating the correct value using a template hook, which works. The code loop that runs for all pages will in some cases provide both the $issue variable and my own variable, but I just wanted to know why is this necessary.

Why isn’t $issue populated for all pages?

I’m using OJS

Many thanks.

Hi @Ant_Forshaw

It’s because by default OJS doesn’t need the latest issue everywhere. The code is designed to be conservative, in order to minimize database queries or cache fetches.


1 Like