OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



highlighting current menu item

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

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

Forum rules
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a technical support question, try the OJS Technical Support subforum.

highlighting current menu item

Postby maxG » Wed Nov 26, 2008 5:30 pm

hello
is it possible to highlight the current menu item?
for instance having ABOUT US in bold or other colour when you're in ABOUT US page?
any way of using {$currentUrl|escape} maybe? checking against {url page="about"} maybe?
thanks in advance
maxG
 
Posts: 2
Joined: Wed Nov 26, 2008 5:03 pm

Re: highlighting current menu item

Postby mcrider » Wed Nov 26, 2008 6:39 pm

Hi max,

This would involve a good bit of template modification, but I'll point you in the right direction..

First, edit the styles/common.css file, and add
Code: Select all
#navbar a.current {
font-weight: bold !important;
}
.. The best place to put is probably with the other #navbar elements around line 250. This will tell links with a certain class name ('current') to style the link bold. You can change it to a different style if you like.

Then open templates/common/navbar.tpl. Here's where you'll have to do some figurin'.. For the first link (Home), add
Code: Select all
{if ($pageTitleTranslated == "Open Journal Systems" || $pageTitleTranslated == "Your Journal")} class="current"{/if}
right after 'a', so it looks like
Code: Select all
<li><a {if ($pageTitleTranslated == "Open Journal Systems" || $pageTitleTranslated == "Your Journal")} class="current"{/if} href="{url page="index"}">{translate key="navigation.home"}</a></li>
.. Replacing "Your Journal" with your journal's title of course. You'll have to do similarly with all of the other links there, figuring out what the page titles for each navigation bar link you want highlighted and adding them to the 'if' statement. There might be a better way than comparing against the page title, but I can't think of one off the top of my head.

Good luck!
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: highlighting current menu item

Postby maxG » Thu Nov 27, 2008 2:45 am

Matt
many thanks indeed for the prompt reply. i'm going to try it out asap, but for what i see it looks just what I was looking for.
i'll let you know how it ends ;)
Max, JournalServer.org
maxG
 
Posts: 2
Joined: Wed Nov 26, 2008 5:03 pm

Re: highlighting current menu item

Postby kekropas » Sat Dec 20, 2008 6:25 am

I would like to know how I could modify my navigation menu like this one
http://www.hhrjournal.org/index.php/hhr
Of course I am not looking for the code, just point me to which files I should work with. I considered a javascript or flashmenu but I don't want to loose tha ability to add navigation links with justone click!
kekropas
 
Posts: 38
Joined: Sat Dec 20, 2008 5:56 am

Re: highlighting current menu item

Postby jmacgreg » Mon Dec 22, 2008 12:34 pm

Hi Kekropas,

That is indeed a good looking -- and very comprehensive -- retheming of OJS. OJS uses the Smarty template system (http://smarty.net) to control the way it looks. All templates are in the templates/ folder -- for example, if you want to change your header or footer, take a look in templates/common/ and you will find header.tpl, footer.tpl, etc. You can make changes to these templates, and they will be combined to make your site.

We don't offer customization support for OJS, but you will be well-served by doing a few things:

1. taking a look at the documentation on the Smarty website;
2. taking a look at http://pkp.sfu.ca/files/docs/customizingojs/index.html (basic, but covers a lot of the easier options like uploading a custom stylesheet);
3. taking a look at other journals for ideas (you can find a longer list at http://pkp.sfu.ca/ojs-journals).

Cheers,
James
jmacgreg
 
Posts: 4183
Joined: Tue Feb 14, 2006 10:50 am

Re: highlighting current menu item

Postby kekropas » Tue Dec 23, 2008 9:02 am

thanks, these are more than enough to start working!
Thanks again
kekropas
 
Posts: 38
Joined: Sat Dec 20, 2008 5:56 am

Re: highlighting current menu item

Postby phu » Mon Jan 12, 2009 7:09 am

hi,

comparing against $pageTitleTranslated is very tedious, when you have implemented more languages. is it possible to only compare against the default language, something like $pageTitle?

thanks in advanced,
phu
phu
 
Posts: 1
Joined: Fri Jan 09, 2009 10:18 am

Re: highlighting current menu item

Postby mcrider » Tue Jan 13, 2009 3:29 pm

Hi phu,

$pageTitle will return the locale key of the page's title, so yes it would be a good choice because it will stay the same regardless of what language is used. BTW, a good way to determine the locale key for each page title is to print it out on each page, e.g. by sticking
Code: Select all
<h1>{$pageTitle}</h1>
at the end of templates/common/header.tpl.

Also, in case it confused anyone, I don't think there is a navbar.tpl file in the current release of OJS, but only the development release. The navbar code should be located in templates/common/header.tpl.

Cheers,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: highlighting current menu item

Postby michelkogan » Fri Sep 14, 2012 2:00 am

you can also use this for home page:

Code: Select all
{if ($pageTitleTranslated == "Open Journal Systems" || $pageTitleTranslated == $currentJournal->getTitle("en_US") )}
michelkogan
 
Posts: 3
Joined: Tue Jun 19, 2012 1:53 am

Re: highlighting current menu item

Postby CarlosLlongo » Wed May 01, 2013 11:54 am

Hi,

I also wanted to highlight the current menu item, this is how i'm doing it:

Code: Select all
{if $smarty.get.page eq 'index' or $smarty.get.page eq ''}
    <li id="home" class="navbar-item current">
{else}
    <li id="home" class="navbar-item">
{/if}
<a href="{url page="index"}">{translate key="navigation.home"}</a></li>


For pages that use de "op" parameter you can use the following:

Code: Select all
{if $smarty.get.page eq 'about' and $smarty.get.op eq 'history'}


Cheers!
CarlosLlongo
 
Posts: 10
Joined: Mon Jun 25, 2012 8:55 am


Return to OJS Development

Who is online

Users browsing this forum: Baidu [Spider] and 5 guests