Highlight current or archive issue/article menu items in OJS 2

Hello,

I’m trying to add an “active” class to navbar menu items in my OJS 2.4.8 theme so I can highlight them appropriately. This is ok for the static items like Home and About. However, I’m having difficulty coming up with a system for “Current” and “Archives” because the URLs are numeric and database-driven.

When a user is on one of the following URLs:
[base-url]/issue/view/number
[base-url]/article/view/number
[base-url]/article/view/number/number

how can I determine whether that number is from the current issue of the journal or not?

I did the static stuff using javascript but I suspect I’ll need to do something in the navbar.tpl with smarty to get this information?

Any help would be much appreciated.

Thanks very much,
Gary

Hi @gizzard

There’s a method in the Issue class called getCurrent() that returns 1 or 0. When you’re dealing with an issue template there is probably going to be an $issue object associated with it. You could call $issue->getCurrent() and test for 1 or 0.

Cheers,

Thanks @jnugent,

I’ll give that a try.

Cheers,
Gary