News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Where to find button['title'] declaration?

Started by xjellyfishx, January 28, 2015, 02:01:41 AM

Previous topic - Next topic

xjellyfishx

First of all, I'm sorry as I'm new here and also bad in PHP.

I would like to locate the declaration of button['title'] which can be found on index.template.php but I couldn't find where does it declared.

For example I can find txt[''] at default -> language, but where does button['title'] declaration is located?

Arantor

Which button['title']? There are two that come to mind.

xjellyfishx

The one at index.template.php.
On menu buttons


        <li',!empty($button['sub_buttons']) ? ' class="has-sub"' : '','>
        <a href="', $button['href'], '">
<span>', $button['title'], '</span>
</a>';

Arantor

If you mean the main menu, that's actually defined in Subs.php using information from one of the language files. Or possibly from some other file if related to a modification.

What exactly are you trying to achieve? The exact nature of what you're trying to do will help me get you the best answer.

xjellyfishx

I tried to search but failed.

What I'm trying to achieve is that for example the My Message [1]. I wanted to find the [1] part which is the on the code I provided above.

I'm trying to do some sort of pop up notification if there is notification for message, notification, etc...

Arantor

Ahhhhh, the [1] part is handled in Subs.php.

It's added onto the Messages title in this chunk of code:
if (!$user_info['is_guest'] && $context['user']['unread_messages'] > 0 && isset($context['menu_buttons']['pm']))
{
$context['menu_buttons']['pm']['alttitle'] = $context['menu_buttons']['pm']['title'] . ' [' . $context['user']['unread_messages'] . ']';
$context['menu_buttons']['pm']['title'] .= ' [<strong>' . $context['user']['unread_messages'] . '</strong>]';
}


Doing a popup notification is surprisingly difficult as we found when implementing this kind of thing in SMF 2.1...

xjellyfishx

I see.

Thank you very much for your guidance and heads up...  :) :) :)

Advertisement: