Customizing SMF > Modifications and Packages
Users Online Today Mod
rickmastfan67:
Has anybody been able to properly code this addon to look like it did in 1.1.x in the 2.0.x branch with the "core" theme or any themes that are based off "core"?
The reason I'm asking is because I just did this myself, but it seems that I made a mistake in the coding in "BoardIndex.template.php" and it's causing the Info Center to get messed up and overflow it's bounds. (See here)
So, here's the code that I put into my file to get it to look properly like 1.1.x in 2.0.x:
--- Code: --- // Users Online Today
echo '
<div class="infocenter_section">
<h4 class="titlebg">', $txt['uot_users_online_'.$modSettings['uot_setting_period']], '</h4>
<div class="windowbg">
<p class="section icon">
<img class="icon" src="', $settings['images_url'], '/icons/online.gif', '" alt="', $txt['uot_users_online_'.$modSettings['uot_setting_period']], '" />','
</p>
<div class="windowbg2 sectionbody">
<div class="inline smalltext">
', $txt['uot_total'], ': <b>', $context['num_users_online_today'], '</b>';
if ($context['viewing_allowed'])
echo
' (', $txt['uot_visible'], ': ', ($context['num_users_online_today'] - $context['num_users_hidden_today']), ', ', $txt['uot_hidden'], ': ', $context['num_users_hidden_today'], ')';
// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online_today']) && $context['viewing_allowed'])
{
echo
'<br />', implode(', ', $context['list_users_online_today']);
}
echo '
</div>
</div>
</div>';
--- End code ---
Somehow, that code is causing the "Info Center" to act up with I have the "Global Headers and Footers" mod installed and I use the Global Footer part.
So, if some of you code geniuses wouldn't mind taking a look at this and can tell me what I did wrong possibly, I would greatly appreciate it. When I was creating this code, I was taking a look at the "Who's Online" section so I could get image to be in a little box like in 1.1.x.
rickmastfan67:
:facepalm:
I've figured out what my mistake was. I forgot to close out one of the "<div>" commands causing it to somehow to absorb the "Global Footer" from the "Global Headers and Footers" mod.
So, if anybody needs the coding for the 2.0.2 "Core" theme, here ya go. This should work just fine now. Hopefully there are no other mistakes in it. :)
./Themes/core/BoardIndex.template.php
--- Code: (Find:) ---// If they are logged in, but statistical information is off... show a personal message bar.
--- End code ---
--- Code: (Add Before:) --- // Users Online Today
echo '
<div class="infocenter_section">
<h4 class="titlebg">', $txt['uot_users_online_'.$modSettings['uot_setting_period']], '</h4>
<div class="windowbg">
<p class="section icon">
<img class="icon" src="', $settings['images_url'], '/icons/online.gif', '" alt="', $txt['uot_users_online_'.$modSettings['uot_setting_period']], '" />','
</p>
<div class="windowbg2 sectionbody">
<div class="inline smalltext">
', $txt['uot_total'], ': <b>', $context['num_users_online_today'], '</b>';
if ($context['viewing_allowed'])
echo
' (', $txt['uot_visible'], ': ', ($context['num_users_online_today'] - $context['num_users_hidden_today']), ', ', $txt['uot_hidden'], ': ', $context['num_users_hidden_today'], ')';
// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online_today']) && $context['viewing_allowed'])
{
echo
'<br />', implode(', ', $context['list_users_online_today']);
}
echo '
</div>
</div>
</div>
</div>';
--- End code ---
Castagna:
Hello,
I tried to install this mod on SMF 2.0.2 currently, and while i'm installing the mod it appears this error:
errors_template.php has been set as 0777 CHMOD. But still giving this error while im installing the mod.
Please someone can help me, im new on this plataform, Thanks.
Old Fossil:
Rather than post an image of the error please keep it as text.
Any errors in your forums error log?
Forum link?
Castagna:
@Old Fossil: Sorry for the pic, and there's no error logs.
Here it's the forum link: ea.vrocker-hosting.co.uk
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version