News:

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

Main Menu

Commenting Out Part of the Stats.template.php

Started by br360, September 21, 2014, 11:14:54 PM

Previous topic - Next topic

br360

I am trying to remove the "Top Topic Starters" and "Most Time Online" information from the stats.template.php. I decided to comment it out instead of deleting it, and it looks like it worked fine. I just want to make sure that how I did it won't affect other stats on that page; (which it appears that it doesn't) and that the opening and closing tags are in the correct places. Does the below look right?

<!--comment out <div id="top_topics_starter">
<div class="title_bar">
<h4 class="titlebg">
<span class="ie6_header floatleft">
<img src="', $settings['images_url'], '/stats_replies.gif" class="icon" alt="" /> ', $txt['top_starters'], '
</span>
</h4>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="content">
<dl class="stats">';

foreach ($context['top_starters'] as $poster)
{
echo '
<dt>
', $poster['link'], '
</dt>
<dd class="statsbar">';

if (!empty($poster['post_percent']))
echo '
<div class="bar" style="width: ', $poster['post_percent'] + 4, 'px;">
<div style="width: ', $poster['post_percent'], 'px;"></div>
</div>';

echo '
<span class="righttext">', $poster['num_topics'], '</span>
</dd>';
}

  echo '
</dl>
<div class="clear"></div>
</div>
<span class="botslice"><span></span></span>
</div>
</div>
<div id="most_online">
  <div class="title_bar">
<h4 class="titlebg">
<span class="ie6_header floatleft">
<img src="', $settings['images_url'], '/stats_views.gif" class="icon"        alt="" /> ', $txt['most_time_online'], '
</span>
</h4>
  </div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="content">
<dl class="stats">';   

foreach ($context['top_time_online'] as $poster)
{
  echo '
<dt>
', $poster['link'], '
</dt>
<dd class="statsbar">';

if (!empty($poster['time_percent']))
echo '
<div class="bar" style="width: ', $poster['time_percent'] + 4, 'px;">
<div style="width: ', $poster['time_percent'], 'px;"></div>
</div>';

echo '
<span>', $poster['time_online'], '</span>
</dd>';
}

echo '
</dl>
<div class="clear"></div>
</div>
<span class="botslice"><span></span></span>
</div>
</div>
</div> -->

Antechinus


br360

I always worry that my little fix will break something big. ;)

Seriously though; I'll usually just delete the code I am trying to get rid of; and this was the first time I decided just to comment it out- so I wanted to make sure I was doing it right.

Antechinus

Actually I just checked and you appear to have added in an extra closing tag at the end. Just run a validation on the page. That will tell you if any tags are messed up.

br360

An extra closing tag? The only closing one I could find was this </div> --> (at the end of the last  </div> )

Any higher I put the tag would still leave some remnants of the total time online, and any lower seemed to break the Forum History part. And forgive the dumb question, but how do I run a validation on the page?

Antechinus

See that link in the footer that says "XHTML"? Click that. ;)

br360


Advertisement: