cherosoullis VIP
Total posts: 165
13 Май 2013 13:20

I have use the notification menu but I have notice that it does not display the number of notification for the user.

Even the notification number is diplayed in the seciton menu.

Is this correct behaviour or is there is a way to display the number of notification in the menu.

Последние изменения: 02 Март 2014


Sergey
Total posts: 13,748
14 Май 2013 02:12

Unfortunately we cannot affect how Joomla menu element is rendered. it is correct behavior.


pepperstreet VIP
Total posts: 3,837
14 Май 2013 13:00

Should be possible with mod_menu override. I would like to see this info on a custom usermenu as well... can you give a hint, how to get this information?

AFAIK, you have a SQL in notification module helper file. Later on you show the total num in document title via JS (notimoo, and bootrap-notify)

And I found it in component view "options", you have $num = CEventsHelper::showNum('total', 0);

What is best practice to generate and access this piece of information? Use the SQL or require your module helper code?


Sergey
Total posts: 13,748
14 Май 2013 13:57

Best way is to use helper class.


Sergey
Total posts: 13,748
14 Май 2013 23:21

Sergey
Total posts: 13,748
14 Май 2013 23:22

Forget to mention that you need to make sure com_cobalt/library/php/helpers/helper.php is included.


pepperstreet VIP
Total posts: 3,837
15 Май 2013 04:16

@Sergey

Don´t dare to ask again ;-)

I have two possible solutions for this:

1.) Use J! Separator MenuItem with special Syntax in title. Seems to be easy to override with own template, without altering other menu items. Drawback: It just displays the Total# without actual link.

2.) Use the Cobalt Notifications menu item.

Is it possible to get/check for a certain J! MenuItem Type? i.e. Hey, you are the notifications type... then do this and that in my override.


Sergey
Total posts: 13,748
15 Май 2013 05:41

I have no suggestion for you. To me it is impossible.


pepperstreet VIP
Total posts: 3,837
18 Май 2013 18:48

Forget to mention that you need to make sure com_cobalt/library/php/helpers/helper.php is included.

Funnily, it seems to work without require the helper.php file ?!

I assume you are using the J! core menu module...

Unzip and copy the attached override file to:

YourJoomlaTemplate -> HTML -> mod_menu


pepperstreet VIP
Total posts: 3,837
18 Май 2013 18:57

:) added one additional space character between title and total num. You might also use CSS to float it right or left for your particular menuitem ID#.


pepperstreet VIP
Total posts: 3,837
29 Сен 2013 06:30

Attachment download does not work?! So, here is the content of my J! core menu module override. (Funnily, it seems to work without "require" the Cobalt helper.php file. If you see no result, then you need to include "com_cobalt/library/php/helpers/helper.php" )

Simply put it here:

YourJoomlaTemplate -> HTML -> mod_menu

<?php

/**

 * @package     Joomla.Site

 * @subpackage  mod_menu

 *

 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.

 * @license     GNU General Public License version 2 or later; see LICENSE.txt

 */

defined('_JEXEC') or die;

// Note. It is important to remove spaces between elements.

$class = $item->anchor_css ? 'class="'.$item->anchor_css.'" ' : '';

$title = $item->anchor_title ? 'title="'.$item->anchor_title.'" ' : '';

if ($item->menu_image)

    {

        $item->params->get('menu_text', 1) ?

        $linktype = '<img src="'.$item->menu_image.'" alt="'.$item->title.'" /><span class="image-title">'.$item->title.'</span> ' :

        $linktype = '<img src="'.$item->menu_image.'" alt="'.$item->title.'" />';

}

else { $linktype = $item->title;

}

// pepperstreet.de - added total amount of Cobalt CCK - Notifications

if (strstr( $item->flink , 'view=notifications')) {$linktype = $linktype.' '.CEventsHelper::showNum('total');}

switch ($item->browserNav) :

    default:

    case 0:

?><a <?php echo $class; ?>href="<?php echo $item->flink; ?>" <?php echo $title; ?>><?php echo $linktype; ?></a><?php

        break;

    case 1:

        // _blank

?><a <?php echo $class; ?>href="<?php echo $item->flink; ?>" target="_blank" <?php echo $title; ?>><?php echo $linktype; ?></a><?php

        break;

    case 2:

    // window.open

?><a <?php echo $class; ?>href="<?php echo $item->flink; ?>" onclick="window.open(this.href,'targetWindow','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes');return false;" <?php echo $title; ?>><?php echo $linktype; ?></a>

<?php

        break;

endswitch;

Работает на Cobalt