Display number of NEW items on the menu

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
starquest321
User
Posts: 140

Display number of NEW items on the menu

Post by starquest321 »

I want to achieve the following enhancement to the menu items:

Based on some condition (new date vs. login date for example) display the number of NEW items on the menu path. It will look very similar to how phone applications display a new item or a new message.

For example:

Customers (3)
Products (12)

I mean menu path is actually next the the MENU ITEM. A similar idea is how an iphone displays the number of new messages in an sms or email. A little number above....

44
Menu Item

And 44 would be calculated based on login date - date added for that user.


danielc
User
Posts: 1601

Post by danielc »

Use MenuItem_Adding server event to change your text:

$MyCount = ew_ExecuteScalar("SELECT COUNT(*) FROM <yourtable>"); // add your condition

if ($Item->Text == "yourmenuname") {
$Item->Text .= "($MyCount)";
}


starquest321
User
Posts: 140

Post by starquest321 »

I want to incorporate a graphic with a circle and the number in it. Just like most alerts that we are used to: Iphone, etc.


danielc
User
Posts: 1601

Post by danielc »

You may use bootstrap badge to create circle, see this getbootstrap.com/2.3.2/components.html#labels-badges.

$Item->Text .= "<span class='badge'>$MyCount</span>";


Post Reply