News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Button Problem

Started by CrisisX, January 25, 2011, 05:28:05 PM

Previous topic - Next topic

CrisisX

This problem has been fixed.

Illori

it looks like if you use $scripturl instead of /index.php?page=buttonpage you might get it to highlight correctly.

for example


// [Downloads] button
'downloads' => array(
'title' => $txt['downloads_menu'],
'href' => $scripturl . '?action=downloads',
'show' => $context['allow_downloads_view'],
'icon' => '',
),

Arantor

It's done off the name.

For 'buttonname' => array... to display, you either need to modify another part of the script, or use action=buttonname.

So what page, exactly, should it be on when highlighting that button?

CrisisX

Quote from: Arantor on January 25, 2011, 05:49:05 PM
It's done off the name.

For 'buttonname' => array... to display, you either need to modify another part of the script, or use action=buttonname.

So what page, exactly, should it be on when highlighting that button?

Yes, this seems to be the problem, how would I make this work for my URLS.

The URL issue is: http://www.crisisx.com/index.php?page=test

If you click the Test button it doesn't highlight, my code doesn't seem to work with $scripturl anyone know? Here is what I'm doing:


'test' => array(
'title' => 'Test',
'href' => $scripturl . '?page=test',
'show' => true,
'sub_buttons' => array(
),
),

Illori

can you attach your whole subs.php file to your next post?

CrisisX

Quote from: Illori on January 25, 2011, 06:11:45 PM
can you attach your whole subs.php file to your next post?

Hmm? What's the point I showed the code I'm using for the button in my last post

Illori

I want to see where in the code yours is being put, which you have not provided us

CrisisX

Quote from: Illori on January 25, 2011, 06:15:06 PM
I want to see where in the code yours is being put, which you have not provided us

In the $buttons array

if (($menu_buttons = cache_get_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'] . '-' . empty($context['disable_sp']), $cacheTime)) === null || time() - $cacheTime <= $modSettings['settings_updated'])
{

$buttons = array(

'test' => array(
'title' => 'Test',
'href' => $scripturl . '?page=test',
'show' => true,
'sub_buttons' => array(
),
),
);


Illori

the code looks correct, any messages in your error log?

also does it work correctly with the default theme?

[edit] your url to the page is http://www.crisisx.com/index.php/page,test.html which leads me to believe this issue may be related to a mod you have installed

CrisisX

Quote from: Illori on January 25, 2011, 06:18:16 PM
the code looks correct, any messages in your error log?

also does it work correctly with the default theme?

[edit] your url to the page is http://www.crisisx.com/index.php/page,test.html which leads me to believe this issue may be related to a mod you have installed

My error log is empty and the same thing seems to happen with the default theme. My only guess would be because I am not using action. Anyone else know?

Illori


Kays

On your test page, before SSI.php is included. Add the following:


$_GET['action'] = 'test';

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

CrisisX

#12
Quote from: Kays on January 25, 2011, 06:30:14 PM
On your test page, before SSI.php is included. Add the following:


$_GET['action'] = 'test';


Added it in Subs-Portal.php before:

if (SMF != 'SSI')
require_once($boarddir . '/SSI.php');


and now every page highlights this, I'm assuming I added it in the wrong area.

Kays

Where is your test page? How did you create it?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

CrisisX

Quote from: Kays on January 25, 2011, 06:46:40 PM
Where is your test page? How did you create it?

via SimplePortal

Kays

Ahh, just saw your edit on that other post..

Having that in Subs.php can mess things up. Try this instead.


if (isset($_GET['page']) && $_GET['page'] == 'test')
   $_GET['action'] = 'test';


If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

CrisisX

Quote from: Kays on January 25, 2011, 07:04:50 PM
Ahh, just saw your edit on that other post..

Having that in Subs.php can mess things up. Try this instead.


if (isset($_GET['page']) && $_GET['page'] == 'test')
   $_GET['action'] = 'test';


Thank-you.

Kays


If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Advertisement: