Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: RL Joneson on April 07, 2008, 11:50:58 AM

Title: Changing Button Order on the Nav Bar
Post by: RL Joneson on April 07, 2008, 11:50:58 AM
Is there a way to move the CALENDAR button on the nav bar to the left, so that its order is preferenced over HELP and SEARCH? I've looked at the Subs.php, and noticed it's placed differently because CALENDAR is a link that can be turned on or off. my subs.php is too big to post, so if you need to see parts of it just let me know. thanks!

Title: Re: Changing Button Order on the Nav Bar
Post by: Nigel on April 07, 2008, 12:58:20 PM
Hi RL,

I think the order they appear in 'subs.php' determines the order they appear when rendered on screen.

Nigel
Title: Re: Changing Button Order on the Nav Bar
Post by: RL Joneson on April 07, 2008, 01:15:13 PM
Is this true? and if so, what would changing the order of something like the CALENDAR, that is an optional feature do?? Can the CALENDAR script be moved up the chain? and if so what is the entire piece of script that has to be moved? I just find it odd that calendar would come after SEARCH and HELP on the nav bar
Title: Re: Changing Button Order on the Nav Bar
Post by: Nigel on April 07, 2008, 01:43:27 PM
I was playing with that button array a few days ago and I recall moving one section and it changed the order. Dunno the exact theory behind it... it just did! So I guess it's a case of trial and error, but I'd make a copy of the file before playing, just in case.

I think the code for the calendar bit is:


'calendar' => array(
'title' => $txt['calendar'],
'href' => $scripturl . '?action=calendar',
'show' => $context['allow_calendar'],
'sub_buttons' => array(
'view' => array(
'title' => $txt['calendar_menu'],
'href' => $scripturl . '?action=calendar',
'show' => allowedTo('calendar_post'),
),
'post' => array(
'title' => $txt['calendar_post_event'],
'href' => $scripturl . '?action=calendar;sa=post',
'show' => allowedTo('calendar_post'),
),
),
),


But I haven't tried. It's quite easy to see the pattern if you study it a bit.

I suppose the logical order of the menu buttons depends on the exact application, so it's hard for the software writers to get it right for everyone. eg. I personally wouldn't have much use for the calendar feature at the moment, so I'd prefer to see it last.

Hmm...
Now there's an idea for a mod if one doesn't exist. Customisable menu order.

Nigel
Title: Re: Changing Button Order on the Nav Bar
Post by: metallica48423 on April 07, 2008, 02:46:04 PM
Yes.  It is iterated through a foreach loop... so they are spit out in the order they are in as defined in the array in Subs.php.  So its a matter of moving each block around.
Title: Re: Changing Button Order on the Nav Bar
Post by: RL Joneson on April 08, 2008, 12:15:11 AM
Worked great! thanks!