Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: br360 on September 21, 2014, 11:14:54 PM

Title: Commenting Out Part of the Stats.template.php
Post by: br360 on September 21, 2014, 11:14:54 PM
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> -->
Title: Re: Commenting Out Part of the Stats.template.php
Post by: Antechinus on September 22, 2014, 12:31:41 AM
If it works fine, why worry? :)
Title: Re: Commenting Out Part of the Stats.template.php
Post by: br360 on September 22, 2014, 12:54:48 AM
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.
Title: Re: Commenting Out Part of the Stats.template.php
Post by: Antechinus on September 22, 2014, 12:57:54 AM
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.
Title: Re: Commenting Out Part of the Stats.template.php
Post by: br360 on September 22, 2014, 01:13:22 AM
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?
Title: Re: Commenting Out Part of the Stats.template.php
Post by: Antechinus on September 22, 2014, 02:01:40 AM
See that link in the footer that says "XHTML"? Click that. ;)
Title: Re: Commenting Out Part of the Stats.template.php
Post by: br360 on September 22, 2014, 02:17:38 AM
Ah, good to know, thank you. :)