ElkArte Community

Project Support => Support => Topic started by: Burke Knight on December 15, 2023, 06:50:07 pm

Title: Highlighted menu item
Post by: Burke Knight on December 15, 2023, 06:50:07 pm
Okay, working on something on my site, and noticed, after made menu button on top level main menu, that when go to the page, it reverts to the "Home" menu item being highlighted. How would I change the Active menu item to be my menu button?

Here's the code for the button:

Code: [Select]
		'images' => array(
'title' => $txt['imagespage'],
'href' => $scripturl . '?page=images',
'data-icon' => 'i-picture',
'show' => true,
),
Title: Re: Highlighted menu item
Post by: Burke Knight on December 15, 2023, 07:05:07 pm
Also, I'd like to know if there's a way to make Custom Title be able to parse BBC?
I'd like the staff to be able to place an image there with the img bbc.
Title: Re: Highlighted menu item
Post by: Spuds on December 16, 2023, 10:18:09 am
Quote from: Burke Knight – How would I change the Active menu item to be my menu button?
The simplest should be to set $context['current_action'] = 'images' ... another way for non simple actions is to set 'action_hook' => true, in your images array.  This will then trigger a call to the integration hook integrate_current_action (to which you registered your program hook).  Then in that function you can decide if the action is yours.in Load.php find 'title' => !empty($modSettings['titlesEnable']) ? $profile['usertitle'] : '', and change that to 'title' => !empty($modSettings['titlesEnable']) ? $parsers->parseCustomFields($profile['usertitle']) : '',  I think that will work.


Title: Re: Highlighted menu item
Post by: Burke Knight on December 16, 2023, 10:50:54 am
Active menu item...
I had tried the $context one, as I didn't use hooks, but straight edit for the button.
However, was not sure where to add it, and if added to the button code in menu, it works, but all pages of site seems to use it.



Custom title worked. :)



Found another issue, with guests:

Code: [Select]
Type of error: Undefined
Notice: Undefined offset: 1
/index.php?topic=696.0
File: /sources/BrowserDetector.class.php
Line: 334

Line: 334
Code: [Select]
			if (trim($match[1]) >= 15)
Title: Re: Highlighted menu item
Post by: Spuds on December 16, 2023, 12:03:54 pm
Did you try adding that inside the function you are calling ... again I think that would work but it may be to late in the process.

The BrowserDetector thing is fixed in 1.1.10 see https://github.com/elkarte/Elkarte/commit/08468d3c690240954fa09918bca9dcc639dbc1ce

I'm working to get 1.1.10 out soon, just looking around for any remaining issues
Title: Re: Highlighted menu item
Post by: Burke Knight on December 16, 2023, 12:10:05 pm
Quote from: Spuds – Did you try adding that inside the function you are calling ...

page=images

Is just a SP html page.