MyBB Community Forums

Full Version: How to add active class to active items in private.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I'll make it short. I have this code in my private.php:
	$numb = $db->query("SELECT * FROM ".TABLE_PREFIX."privatemessages WHERE uid='".$mybb->user['uid']."' AND folder='".$folderinfo[0]."'");
	$numb = $db->num_rows($numb);
	$folderlinks .= "<li{$activeitem}><a href=\"private.php?fid=$folderinfo[0]\"\">{$class} <span>$folderinfo[1] ($numb)</span></a></li>\n";

This code produces PM folders between list tags.
I have added the variable $activeitem in the li tag.

$activeitem = "class=\"active\"";

Now I want to add this class to each active li tag.
For instance, if I am in private.php?fid=1, (which is the inbox folder), the class "active" should be added to the li tag of the inbox folder and so on.

I have tested this by making this example if condition:

if($mybb->input['fid'] == 1)
{
	$activeitem ="class=\"active\"";
}
else
{
	$activeitem ="";
}

But I overlooked something because this would add the class "active" to all li tags, not just the actual active tag.

Any ideas?
Do I have to give up on this? Nobody has a clue?