News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Please Help with Modification of Info Center

Started by dayo, July 28, 2007, 03:03:05 AM

Previous topic - Next topic

dayo

Hello
I asked this over at TP before realising that it might be more appropriate here.

I have set up my site & it is working great.  However, I will like to modify the info center at the bottom.

At present, it shows X Guests & Y Users viewing the site but I will like it just to show Z Users viewing the site where Z = X + Y.  I want to make this change because it is a new site with few registered users and the numbers doesn't look too good at the moment lol.  Logged in users can see the breakdown with the stats sidebox.

I think I found the relevant bit of code that controls this in BoardIndex.template.php but need some help in editing it.


echo '
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', $context['num_guests'], ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ' . $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];


I tried


$allviewers = $context['num_guests'] + $context['num_users_online']

echo '
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', $allviewers, ' ', $allviewers == 1 ? $txt['user'] : $txt['users'];


but it just generates an error.

Thanks a mil.

karlbenson

#1

$allviewers = (int) $context['num_guests'] + $context['num_users_online'];

echo '
'. $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : $allviewers . ' ' . $allviewers == 1 ? $txt['user'] : $txt['users'];


Missing the odd semi-colon. And removed '', (as its not needed), and replace use of comma by dot operator. Although its slower. When using these types of conditional statements, php doesnt like them always being used.

dayo

Hi.

Thanks for the response.  The code you gave does not work.  However I found that if I kept the original second line, it works.   



$allviewers = (int) $context['num_guests'] + $context['num_users_online'];

echo '
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', $allviewers, ' ', $allviewers == 1 ? $txt['user'] : $txt['users'];


Sorted!

Thanks again.

Advertisement: