Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
in Q2A Core by
This might be a bit odd. Basically, I set up a chat room and have a tab that links to the chat in the nav in a custom theme.

I want to list how many people are in the chat in the tab. So the tab would say something like "Chat $Num_Active_Users" Where $Num_Active_Users is the number of people that are chatting. And don't worry, I already know how to get the variable. I'm just stumped on how to insert it into the tab.

1 Answer

+1 vote
I got that part down. I was thinking something like this.

$blah = "something here";
    class qa_html_theme extends qa_html_theme_base
        function nav_list($navigation, $navtype)
            if ($navtype=='main')
                $navigation['custom']=array( 'url' => 'http://your-page/', 'label' => '$blah');
            qa_html_theme_base::nav_list($navigation, $navtype);

If that makes sense.
OK, so just remove the single quotes around $blah - you can also concatenate strings in PHP by doing this:

'prefix '.$blah.' suffix'

Or this:

"prefix $blah suffix"
I had to move the the database query inside the function to get it to work. But it works now. You can see here http://stfudamnit.com/ if you care. It is just a joke site.