This topic is locked

is it possible to show record count on menu item

6/3/2022 2:58:08 PM
PHPRunner General questions
W
wfcentral author

I have a table for "friend_requests".

On my menu I have a link that goes to view this table. I would like to update that menu item so it shows a count of how many items are in that table.

Once users accept friend requests I move them to another table. So, this count would give them a quick indicator they have "things to do".

Sergey Kornilov admin 6/3/2022

Sure, see code examples here.

P
ppradhan@live.com 6/3/2022

@wfcentral,

I have done similar task in my project. See below an example to get the counter in the Menu.
Place code in Menu Item: Modify

It looks like this:
if ($title=="Friend Requests") {

$count = DBLookup("select count(*) from friend_requests");
$title.=" <span class='mbadge mbadge-blue'>".$count."</span>";

$menuItem->setTitle($title);

}