Advertisement:

Author Topic: [Tutorial] - Top 10 Estatísticas do Fórum v3  (Read 3938 times)

Offline Joomlamz

  • SMF Hero
  • ******
  • Posts: 2,630
  • Gender: Male
  • Suporte SmfPT
    • apllicmz on Facebook
    • apllicmz on GitHub
    • https://www.linkedin.com/in/aplic on LinkedIn
    • @aplichosting on Twitter
    • Webdesign
[Tutorial] - Top 10 Estatísticas do Fórum v3
« on: October 07, 2014, 01:38:34 PM »
index.css

Abrir o ficheiro acima depois Por favor, adicione.

Code: [Select]
.wmtop10{
    font-family:Verdana;
    font-size:11px;
    font-weight:bold;
    color:#666;
    padding-bottom:1px;
    border-bottom:1px dashed #999;
    padding-top:2px;
}

.wmtop10:last-child{
    border-bottom:0;
}.wmtop10 a{
    text-decoration:none;
    color:#666;
}
.wmtop10 a:hover{
    text-decoration:underline;
}
.top1{
    background:url(../images/top1.gif) left no-repeat;
    padding-left:18px;
    margin-top:3px;
}
.top2{
    background:url(../images/top2.gif) left no-repeat;
    padding-left:18px;
    margin-top:3px;
}
.top3{
    background:url(../images/top3.gif) left no-repeat;
    padding-left:18px;
    margin-top:3px;
}
.top4{
    background:url(../images/top4.gif) left no-repeat;
    padding-left:18px;
    margin-top:3px;
}
.top5{
    background:url(../images/top5.gif) left no-repeat;
    padding-left:18px;
    margin-top:3px;
}
.top6{
    background:url(../images/top6.gif) left no-repeat;
    padding-left:18px;
    margin-top:3px;
}
.top7{
    background:url(../images/top7.gif) left no-repeat;
    padding-left:18px;
    margin-top:3px;
}
.top8{
    background:url(../images/top8.gif) left no-repeat;
    padding-left:18px;
    margin-top:3px;
}
.top9{
    background:url(../images/top9.gif) left no-repeat;
    padding-left:18px;
    margin-top:3px;
}
.top10{
    background:url(../images/top10.gif) left no-repeat;
    padding-left:18px;
    margin-top:3px;
}
.table_blog
{
    border:0;
    width: 100%;
}
.marquee {
   height:500px
}
.top10sag
{
   align-right: 5px;
   margin-right: 4px;
   
}



index.template.php

Abrir o ficheiro e pesquisar no template

Code: [Select]
<script type="text/javascript" src="', $settings['theme_url'], '/scripts/theme.js?fin20"></script>
Adicionar por baixo

Code: [Select]
     <link rel="stylesheet" type="text/css" href="/top10/SpryTabbedPanels10.css"/>
     <link rel="stylesheet" type="text/css" href="/top10/SpryTabbedPanels11.css"/>
     <link rel="stylesheet" type="text/css" href="/top10/SpryTabbedPanels12.css"/>


BoardIndex.template.php

Pesquisar por este codigo

Code: [Select]
   // Show the news fader?  (assuming there are things to show...)


Adicionar topo da Pesquisa

Code: [Select]
/***************************************************************************
*************** START THE TAB www.igo8navigation.com TOP 10 ****************
***************************************************************************/
 echo '
    <table width="99%">
  <tr>
 
  <td class="TabbedPanelsContentGroup10" width="25%"  valign="top" style="border:1px solid #A7B5BD;margin-left:5px;">
    <script src="/top10/SpryTabbedPanels10.js" type="text/javascript"></script>
     
                <div id="TabbedPanels10" class="TabbedPanels10">
           <ul class="TabbedPanelsTabGroup10">
               
                <li class="TabbedPanelsTab10sag">' .$txt['en_yeni_uye']. '</li>
                <li class="TabbedPanelsTab10">' .$txt['en_rastgele_konular']. '</li>
            </ul>
            <div class="TabbedPanelsContentGroup10">
        <div class="TabbedPanelsContent10">';
 echo '

   
       <table  width="100%" cellpadding="0" cellspacing="0">
    <tr>
       <td width="100%" valign="top" style="padding:1px;text-transform:capitalize;">';

/***************************************************************************
*************** END THE TAB ************************************************
***************************************************************************/

$wm=0;
global $db_prefix;
$eyu=mysql_query("select id_member,real_name,posts from {$db_prefix}members order by id_member desc limit 10");
while($row=mysql_fetch_array($eyu)){
$wm++;
$grup=mysql_fetch_array(mysql_query("Select * from {$db_prefix}members where id_member = '".$row['id_member']."'"));
if($grup['id_group']==0){
$renk=mysql_fetch_array(mysql_query("Select * from {$db_prefix}membergroups where id_group = '".$grup['id_post_group']."'"));
}else{
$renk=mysql_fetch_array(mysql_query("Select * from {$db_prefix}membergroups where id_group = '".$grup['id_group']."'"));
}
echo '
<table width="95%" class="wmtop10" cellpadding="0" cellspacing="0">
<tr><td class="top'.$wm.'" valign="top" width="80%">'.(!$row['real_name']?'':'<a href="'.$scripturl.'?action=profile;u='.$row['id_member'].'">').'<span style="color:'.$renk['online_color'].';font-weight:normal;">'.(!$row['real_name']?'Ziyaretçi':''.$row['real_name'].'').'</span></a></td>
<td width="20%" align="right" valign="top"><span style="font-weight:normal;">'.$row['posts'].'</span></td>
</tr></table>';
}


echo '
        </td>
      </tr>
  </table>';

/***************************************************************************
*************** END THE TAB ************************************************
***************************************************************************/
    echo'</div>
        <div class="TabbedPanelsContent10">';

/***************************************************************************
*************** START THE TAB ************************************************
***************************************************************************/

   global $db_prefix;
   $wm=0;
   $rand=mysql_query("select id_topic from {$db_prefix}topics order by rand() limit 10");
   while($rrow=mysql_fetch_array($rand)){
   $row=mysql_fetch_array(mysql_query("select id_topic,subject from {$db_prefix}messages where id_topic = '".$rrow['id_topic']."'"));
   $wm++;
   $row['subject']=str_replace("Ynt:","",$row['subject']);
   $krow=substr($row['subject'],0,22);
   $ksay=strlen($row['subject']);
   echo '
   <table width="96%" class="wmtop10" cellpadding="0" cellspacing="0">
   <tr>
    <td class="top'.$wm.'" valign="top" width="100%"><a title="'.$row['subject'].'" href="'.$scripturl.'?topic='.$row['id_topic'].'.0">';
   if($ksay>30){
   echo $krow.'..';
}
  else{
   echo $row['subject'];
}
    echo '</a></td></tr></table>';
}


/***************************************************************************
***************END THE TAB  *******************************************
***************************************************************************/

    echo'</div>
    </div>
</div>
<script type="text/javascript">
<!--
var TabbedPanels = new Spry.Widget.TabbedPanels("TabbedPanels10");
Spry.Widget.TabbedPanels("TabbedPanels10");
//-->
</script></td> ';

/***************************************************************************
*************** END THE TAB SOL BOLUM **************************************
***************************************************************************/
echo '
<td class="TabbedPanelsContentGroup11" width="50%" valign="top" style="border-right:1px solid #A7B5BD;border-bottom:1px solid #A7B5BD;border-top:1px solid #A7B5BD;border-radius: 0px 0px 0px 0px;margin-left:0px;">

 <script src="/top10/SpryTabbedPanels11.js" type="text/javascript"></script>
     
                <div id="TabbedPanels11" class="TabbedPanels11">
           <ul class="TabbedPanelsTabGroup11">
              <li class="TabbedPanelsTab11sag">' .$txt['en_cok_cevaplanan'] . '</li>
              <li class="TabbedPanelsTab11">' .$txt['en_son_yazilan']. '</li>
              <li class="TabbedPanelsTab11">' .$txt['en_cok_goruntulenen'] . '</li>
    </ul>
    <div class="TabbedPanelsContentGroup11">
        <div class="TabbedPanelsContent11">';

/***************************************************************************
*************** START THE TAB ECC*******************************************
***************************************************************************/global $db_prefix;
  if($_GET['wm']=="esy" or !$_GET['wm']=="ecc" or !$_GET['wm']=="ecg"){
$wm=0;
$ecc=mysql_query("select id_topic,num_replies,num_views from {$db_prefix}topics order by num_replies desc limit 10");
while($erow=mysql_fetch_array($ecc)){
$row=mysql_fetch_array(mysql_query("select id_topic,subject from {$db_prefix}messages where id_topic = '".$erow['id_topic']."'"));
$wm++;
$row['subject']=str_replace("Ynt:","",$row['subject']);
$krow=substr($row['subject'],0,45);
$ksay=strlen($row['subject']);
echo '<table width="98%" class="wmtop10" cellpadding="0" cellspacing="0">
<tr>
<td class="top'.$wm.'" valign="top" width="80%"><a title="'.$row['subject'].'" href="'.$scripturl.'?topic='.$row['id_topic'].'.0">';
if($ksay>45){
echo $krow.'..';
}else{
echo $row['subject'];
}
echo '</a></td>
<td width="20%" align="right" valign="top">'.$erow['num_replies'].'</td>
</tr></table>';}
}   
/***************************************************************************
*************** END THE TAB ************************************************
***************************************************************************/
    echo'</div>
        <div class="TabbedPanelsContent11">';
/***************************************************************************
*************** START THE TAB  ECY*******************************************
***************************************************************************/     global $db_prefix;
if($_GET['wm']=="esy" or !$_GET['wm']=="ecc" or !$_GET['wm']=="ecg"){
$wm=0;
$esy=mysql_query("select id_topic,id_msg,id_member,subject from {$db_prefix}messages order by id_msg desc limit 10");
while($row=mysql_fetch_array($esy)){
$wm++;
$row['subject']=str_replace("Ynt:","",$row['subject']);
$krow=substr($row['subject'],0,45);
$ksay=strlen($row['subject']);
$mname=mysql_fetch_array(mysql_query("select id_member,real_name from {$db_prefix}members where id_member = '".$row['id_member']."'"));
$grup=mysql_fetch_array(mysql_query("Select * from {$db_prefix}members where id_member = '".$row['id_member']."'"));
if($grup['id_group']==0){
$renk=mysql_fetch_array(mysql_query("Select * from {$db_prefix}membergroups where id_group = '".$grup['id_post_group']."'"));
}else{
$renk=mysql_fetch_array(mysql_query("Select * from {$db_prefix}membergroups where id_group = '".$grup['id_group']."'"));
}
  echo '
   <table width="98%" class="wmtop10" cellpadding="0" cellspacing="0">
  <tr>
  <td class="top'.$wm.'" valign="top" width="80%"><a title="'.$row['subject'].'" href="'.$scripturl.'?topic='.$row['id_topic'].'.0;msg'.$row['id_msg'].';topicseen#msg'.$row['id_msg'].'">';
  if($ksay>45){
  echo $krow.'..';
}
else{
echo $row['subject'];
}
echo '</a></td>
<td width="20%" align="right" valign="top">'.(!$mname['id_member']?'':'<a href="'.$scripturl.'?action=profile;u='.$mname['id_member'].'">').'<span style="font-weight:normal;color:'.$renk['online_color'].'">'.(!$mname['real_name']?'Ziyaretçi':''.$mname['real_name'].'').'</span>'.(!$mname['id_member']?'':'</a>').'
</td>
</tr></table>';
}
}
/***************************************************************************
*************** END THE TAB ************************************************
***************************************************************************/
    echo'</div>
        <div class="TabbedPanelsContent11">';
       
/***************************************************************************
*************** START THE TAB ECG********************************************
***************************************************************************/
   global $db_prefix;
  if($_GET['wm']=="esy" or !$_GET['wm']=="ecc" or !$_GET['wm']=="ecg"){
$wm=0;
$ecg=mysql_query("select id_topic,num_replies,num_views from {$db_prefix}topics order by num_views desc limit 10");
while($erow=mysql_fetch_array($ecg)){
$row=mysql_fetch_array(mysql_query("select id_topic,subject from {$db_prefix}messages where id_topic = '".$erow['id_topic']."'"));
$wm++;
$row['subject']=str_replace("Ynt:","",$row['subject']);
$krow=substr($row['subject'],0,45);
$ksay=strlen($row['subject']);
echo '<table width="98%" class="wmtop10" cellpadding="0" cellspacing="0">
<tr>
<td class="top'.$wm.'" valign="top" width="80%"><a title="'.$row['subject'].'" href="'.$scripturl.'?topic='.$row['id_topic'].'.0">';
if($ksay>45){
echo $krow.'..';
}else{
echo $row['subject'];
}
echo '</a></td>
<td class="top10sag" width="20%" align="right" valign="top">'.$erow['num_views'].'</td>
</tr></table>';}
}
    echo'</div>
    </div>
</div>
<script type="text/javascript">
<!--
var TabbedPanels = new Spry.Widget.TabbedPanels("TabbedPanels11");
Spry.Widget.TabbedPanels("TabbedPanels11");
//-->
</script></td>';

/***************************************************************************
*************** END THE TAB ************************************************
***************************************************************************/
   
 echo '
<td class="TabbedPanelsContentGroup12" width="25%"  valign="top" style="border-left:0px solid #A7B5BD;border-top:1px solid #A7B5BD;border-bottom:1px solid #A7B5BD;border-right:1px solid #A7B5BD;margin-right:10px;">';


 echo '

<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" valign="top" style="padding:1px;">';

echo'
    <script src="/top10/SpryTabbedPanels12.js" type="text/javascript"></script>
     
                <div id="TabbedPanels12" class="TabbedPanels12">
           <ul class="TabbedPanelsTabGroup12">
                <li class="TabbedPanelsTab12sag">' .$txt['en_cok_yazan_uye']. '</li>
                <li class="TabbedPanelsTab12">' .$txt['en_cok_konu_acan']. '</li>
            </ul>
            <div class="TabbedPanelsContentGroup12">
        <div class="TabbedPanelsContent12">';







/***************************************************************************
*************** START THE TAB ECY********************************************
***************************************************************************/

$wm=0;
if($_GET['wm']=="ecy"){

$eyu=mysql_query("select id_member,real_name,posts from {$db_prefix}members order by id_member desc limit 10");
while($row=mysql_fetch_array($eyu)){
$wm++;
$grup=mysql_fetch_array(mysql_query("Select * from {$db_prefix}members where id_member = '".$row['id_member']."'"));
if($grup['id_group']==0){
$renk=mysql_fetch_array(mysql_query("Select * from {$db_prefix}membergroups where id_group = '".$grup['id_post_group']."'"));
}else{
$renk=mysql_fetch_array(mysql_query("Select * from {$db_prefix}membergroups where id_group = '".$grup['id_group']."'"));
}
echo '
<table width="95%" class="wmtop10" cellpadding="0" cellspacing="0">
<tr><td class="top'.$wm.'" valign="top" width="80%">'.(!$row['real_name']?'':'<a href="'.$scripturl.'?action=profile;u='.$row['id_member'].'">').'<span style="color:'.$renk['online_color'].';font-weight:normal;">'.(!$row['real_name']?'Ziyaretçi':''.$row['real_name'].'').'</span></a></td>
<td width="20%" align="right" valign="top"><span style="font-weight:normal;">'.$row['posts'].'</span></td>
</tr></table>';
}
}


else{
$ecy=mysql_query("select id_member,real_name,posts from {$db_prefix}members order by posts desc limit 10");
while($row=mysql_fetch_array($ecy)){
$wm++;
$grup=mysql_fetch_array(mysql_query("Select * from {$db_prefix}members where id_member = '".$row['id_member']."'"));
if($grup['id_group']==0){
$renk=mysql_fetch_array(mysql_query("Select * from {$db_prefix}membergroups where id_group = '".$grup['id_post_group']."'"));
}else{
$renk=mysql_fetch_array(mysql_query("Select * from {$db_prefix}membergroups where id_group = '".$grup['id_group']."'"));
}
echo '
<table width="95%" class="wmtop10" cellpadding="0" cellspacing="0">
<tr><td class="top'.$wm.'" valign="top" width="80%"><a href="'.$scripturl.'?action=profile;u='.$row['id_member'].'"><span style="color:'.$renk['online_color'].';font-weight:normal;">'.$row['real_name'].'</span></a></td>
<td width="20%" align="right" valign="top"><span style="font-weight:normal;">'.$row['posts'].'</span></td>
</tr></table>';
}
}

/***************************************************************************
*************** END THE TAB ************************************************
***************************************************************************/
    echo'</div>
        <div class="TabbedPanelsContent12">';
       
/***************************************************************************
*************** START THE TAB ECK********************************************
***************************************************************************/
global $db_prefix;
$wm=0;
$uyeler=mysql_query("select id_member from smf_members limit 1");
while($row=mysql_fetch_array($uyeler)){
$id_member=$row['id_member'];
$say=mysql_query("select count(id_member_started) as count, id_member_started from smf_topics group by id_member_started order by count desc limit 10");
while($rsay=mysql_fetch_array($say)){
$wm++;
$grup=mysql_fetch_array(mysql_query("Select * from smf_members where id_member = '".$rsay['id_member_started']."'"));
if($grup['id_group']==0){
$renk=mysql_fetch_array(mysql_query("Select * from smf_membergroups where id_group = '".$grup['id_post_group']."'"));
}else{
$renk=mysql_fetch_array(mysql_query("Select * from smf_membergroups where id_group = '".$grup['id_group']."'"));
}
$isim=mysql_fetch_array(mysql_query("select id_member,real_name from smf_members where id_member = '".$rsay['id_member_started']."'"));
echo '<table width="95%" class="wmtop10" cellpadding="0" cellspacing="0">
<tr><td class="top'.$wm.'" valign="top" width="80%">'.(!$isim['real_name']?'':'<a href="'.$scripturl.'?action=profile;u='.$rsay['id_member_started'].'" title="'.$isim['real_name'].'">').'<span style="color:'.$renk['online_color'].';font-weight:normal;">'.(!$isim['real_name']?'Ziyaretçi':''.$isim['real_name'].'').'</span>'.(!$isim['real_name']?'':'</a>').'</td>
<td width="20%" align="right" valign="top"><span style="font-weight:normal;">'.$rsay[0].'</span></td>
</tr></table>';
}
}


    echo'
   </div>
</div>
</div></td>';

echo '

</tr>
</table>


<script type="text/javascript">
<!--
var TabbedPanels = new Spry.Widget.TabbedPanels("TabbedPanels12");
Spry.Widget.TabbedPanels("TabbedPanels12");
//-->
</script></td>';
/***************************************************************************
*************** END THE TAB ************************************************
***************************************************************************/
echo '

</tr>
</table><br />';



/***************************************************************************
*************** END THE TAB www.igo8navigation.com Top 10 ******************
***************************************************************************/

Modifications.portuguese_pt.php ou Modifications.teuidioma.php

Code: [Select]
// igo8navigation Top 10 Sitenin Enleri  Translate By Candidosa2
$txt['en_son_yazilan'] = 'Mensagens mais recentes';
$txt['en_cok_cevaplanan'] = 'Mais Respondidas';
$txt['en_cok_goruntulenen'] = 'Os mais vistos';
$txt['en_rastgele_konular'] = 'T&oacute;picos Aleat&oacute;rio';
$txt['en_cok_yazan_uye'] = 'Top Membro';
$txt['en_cok_konu_acan'] = 'Top t&oacute;picos';
$txt['en_yeni_uye'] = 'Membros mais recentes';
// igo8navigation Top 10 Sitenin Enleri  Support by smfpt.net

Os ficheiros estao no anexo para colocar na devida pasta
Podera ver o demo aqui a funcionar a 100%  http://www.webmastermz.com/index.php?action=forum



Offline DSystem

  • Jr. Member
  • **
  • Posts: 238
  • Gender: Male
  • EletronicaBR - Admin
    • eletronicaBR.com
Re: [Tutorial] - Top 10 Estatísticas do Fórum v3
« Reply #1 on: October 07, 2014, 08:46:04 PM »
Gostei deste top dez. Depois vou colocar no meu fórum.

Vou tentar adicionar também o top do Karma

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Re: [Tutorial] - Top 10 Estatísticas do Fórum v3
« Reply #2 on: October 07, 2014, 09:00:49 PM »
Atenção... Ainda que a ideia seja boa, este código tem *vários* problemas:
* Queries no template
* Utilização de funções nativas MySQL em vez da utilização $smcFunc que permite abstracção do motor da BD, codificação/linguagem, etc
* Imensas, imensas queries executadas por cada carregamento da página principal. Facilmente ultrapassam as 30 :o Muito problemático em foruns movimentados...

Não quer dizer que não se use mas... com cuidado ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair