Uutiset:

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

Main Menu
Advertisement:

is it possible to export stats from the stats page to forum index?

Aloittaja timned88, helmikuu 16, 2009, 11:03:48 IP

« edellinen - seuraava »

timned88

for example. is it possible to have the top posters and their totals, etc. exported to the forum index page near the info center?
i understand it would go in board index but how would i do that?

timned88

i have been able to get THIS far copy/pasting code from the stats.template.php to boardindex.template.php...   but none of the data values are passed thru.  what am i missing here?


if (!empty($modSettings['hitStats']))
      echo ' 
     <table> <tr>
<td class="catbg" colspan="2" width="50%"><b>', $txt['top_posters_day'], '</b></td>
<td class="catbg" colspan="2" width="50%"><b>', $txt['top_posters_week'], '</b></td>
</tr><tr>
<td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_posters.gif" width="20" height="20" alt="" /></td>
<td class="windowbg2" width="50%" valign="top">
<table border="0" cellpadding="1" cellspacing="0" width="100%">';
foreach ($context['top_posters_week'] as $poster)
echo '
<tr>
<td width="60%" valign="top">', $poster['link'], '</td>
<td width="20%" align="left" valign="top">', $poster['num_posts'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $poster['post_percent'] . '" height="15" alt="" />' : '&nbsp;', '</td>
<td width="20%" align="right" valign="top">', $poster['num_posts'], '</td>
</tr>';
echo '
</table>
</td>
<td class="windowbg" width="20" valign="middle" align="center" nowrap="nowrap"><img src="', $settings['images_url'], '/stats_posters.gif" width="20" height="20" alt="" /></td>
<td class="windowbg2" width="50%" valign="top">
<table border="0" cellpadding="1" cellspacing="0" width="100%">';
foreach ($context['top_posters_month'] as $poster)
echo '
<tr>
<td width="60%" valign="top">', $poster['link'], '</td>
<td width="20%" align="left" valign="top">', $poster['num_posts'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $poster['post_percent'] . '" height="15" alt="" />' : '&nbsp;', '</td>
<td width="20%" align="right" valign="top">', $poster['num_posts'], '</td>
</tr>';
echo '
</table>
</td>
</tr>';


the screenshot shows what it looks like so far....  i can move it inside some of the div's once i get the data to pass thru properly.

karlbenson

That data is only queried on the Stats page in the Sources/Stats.php file.

Generally it wouldn't be recommended to do what you wanting to do.
Some of the stats querys are extremely intensive and if put on a common page like the boardindex, it will likely add considerable load to your forum.

Rumbaar

As suggested, it's not recommended due to the unnecessary load on your server.  But look to the $source/Stats.php page for the actual data generating queries.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Advertisement: