MTASA TÜRK
Türkiye'nin En Güncel MTA Platformu


[SimpleMachinesForum] Top 10 Eklentisi ve Kodlaması

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı Samsunlee

  • Acemi Üye
  • *
    • İleti: 167
Merhaba Arkadaşlar , Alıntıdır.

Eklentiyi Kurdugunuzda Alacagınız Sonuç


Bir smf.konusal.com yapımıdır

Sources/BoardIndex.php de bul

Kod: html
$context['page_title'] = sprintf($txt['forum_index'], $context['forum_name']);

Altına Ekleyiniz.

 
Kod: html
global $context, $smcFunc, $txt, $scripturl, $modSettings;
//smf.konusal.com En cok Konu acan top 10
if (($members = cache_get_data('stats_top_starters', 360)) == null)
 {
 $request = $smcFunc['db_query']('', '
 SELECT id_member_started, COUNT(*) AS hits
 FROM {db_prefix}topics' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
 WHERE id_board != {int:recycle_board}' : '') . '
 GROUP BY id_member_started
 ORDER BY hits DESC
 LIMIT 10',
 array(
 'recycle_board' => $modSettings['recycle_board'],
 )
 );
 $members = array();
 while ($row = $smcFunc['db_fetch_assoc']($request))
 $members[$row['id_member_started']] = $row['hits'];
 $smcFunc['db_free_result']($request);

 cache_put_data('stats_top_starters', $members, 360);
 }

 if (empty($members))
 $members = array(0 => 0);
 $members_result = $smcFunc['db_query']('', '
 SELECT id_member, real_name
 FROM {db_prefix}members
 WHERE id_member IN ({array_int:member_list})
 ORDER BY FIND_IN_SET(id_member, {string:top_topic_posters})
 LIMIT 10',
 array(
 'member_list' => array_keys($members),
 'top_topic_posters' => implode(',', array_keys($members)),
 )
 );
 $context['top_starters'] = array();
 $max_num_topics = 1;
 while ($row_members = $smcFunc['db_fetch_assoc']($members_result))
 {
 $context['top_starters'][] = array(
 'name' => $row_members['real_name'],
 'id' => $row_members['id_member'],
 'num_topics' => $members[$row_members['id_member']],
 'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
 );

 if ($max_num_topics < $members[$row_members['id_member']])
 $max_num_topics = $members[$row_members['id_member']];
 if (!empty($modSettings['MemberColorStats']))
 $context['MemberColor_ID_MEMBER'][$row_members['id_member']] = $row_members['id_member'];
 }
 $smcFunc['db_free_result']($members_result);

 foreach ($context['top_starters'] as $i => $topic)
 {
 $context['top_starters'][$i]['post_percent'] = round(($topic['num_topics'] * 100) / $max_num_topics);
 $context['top_starters'][$i]['num_topics'] = comma_format($context['top_starters'][$i]['num_topics']);
 }
//smf.konusal.com En cok Konu acan top 10 Bitti
//smf.konusal.com Yeni uyeler top 10
   $members_result =  $smcFunc['db_query']('', '
      SELECT id_member, real_name, posts
      FROM {db_prefix}members
      ORDER BY id_member DESC
      LIMIT 10',
      array(
      )
   );
   $context['new_members'] = array();
   while ($row_members = $smcFunc['db_fetch_assoc']($members_result))
   {
      $context['new_members'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );
   }
   $smcFunc['db_free_result']($members_result);
//smf.konusal.com Yeni uyeler top 10 bitti
//smf.konusal.com En cok mesaj atan top 10.
 $members_result = $smcFunc['db_query']('', '
 SELECT id_member, real_name, posts
 FROM {db_prefix}members
 WHERE posts > {int:no_posts}
 ORDER BY posts DESC
 LIMIT 10',
 array(
 'no_posts' => 0,
 )
 );
 $context['top_posters'] = array();
 $max_num_posts = 1;
 $context['MemberColor_ID_MEMBER'] = array();
 while ($row_members = $smcFunc['db_fetch_assoc']($members_result))
 {
 $context['top_posters'][] = array(
 'name' => $row_members['real_name'],
 'id' => $row_members['id_member'],
 'num_posts' => $row_members['posts'],
 'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
 );

 if ($max_num_posts < $row_members['posts'])
 $max_num_posts = $row_members['posts'];
 if (!empty($modSettings['MemberColorStats']) && !empty($row_members['id_member']))
 $context['MemberColor_ID_MEMBER'][$row_members['id_member']] = $row_members['id_member'];
 }
 $smcFunc['db_free_result']($members_result);

 foreach ($context['top_posters'] as $i => $poster)
 {
 $context['top_posters'][$i]['post_percent'] = round(($poster['num_posts'] * 100) / $max_num_posts);
 $context['top_posters'][$i]['num_posts'] = comma_format($context['top_posters'][$i]['num_posts']);
 }
//smf.konusal.com En cok mesaj atan top 10 Bitti
//smf.konusal.com En cok yanitlananlar top 10.
 $topic_ids = array();
 $topic_reply_result = $smcFunc['db_query']('', '
 SELECT m.subject, t.num_replies, t.id_board, t.id_topic, b.name
 FROM {db_prefix}topics AS t
 INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
 INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
 AND b.id_board != {int:recycle_board}' : '') . ')
 WHERE {query_see_board}' . (!empty($topic_ids) ? '
 AND t.id_topic IN ({array_int:topic_list})' : ($modSettings['postmod_active'] ? '
 AND t.approved = {int:is_approved}' : '')) . '
 ORDER BY t.num_replies DESC
 LIMIT 10',
 array(
 'topic_list' => $topic_ids,
 'recycle_board' => $modSettings['recycle_board'],
 'is_approved' => 1,
 )
 );
 $context['top_topics_replies'] = array();
 $max_num_replies = 1;
 while ($row_topic_reply = $smcFunc['db_fetch_assoc']($topic_reply_result))
 {
 censorText($row_topic_reply['subject']);

 $context['top_topics_replies'][] = array(
 'id' => $row_topic_reply['id_topic'],
 'board' => array(
 'id' => $row_topic_reply['id_board'],
 'name' => $row_topic_reply['name'],
 'href' => $scripturl . '?board=' . $row_topic_reply['id_board'] . '.0',
 'link' => '<a href="' . $scripturl . '?board=' . $row_topic_reply['id_board'] . '.0">' . $row_topic_reply['name'] . '</a>'
 ),
 'subject' => $row_topic_reply['subject'],
 'num_replies' => $row_topic_reply['num_replies'],
 'href' => $scripturl . '?topic=' . $row_topic_reply['id_topic'] . '.0',
 'link' => '<a href="' . $scripturl . '?topic=' . $row_topic_reply['id_topic'] . '.0">' .$row_topic_reply['subject'] . '</a>'
 );

 if ($max_num_replies < $row_topic_reply['num_replies'])
 $max_num_replies = $row_topic_reply['num_replies'];
 }
 $smcFunc['db_free_result']($topic_reply_result);

 foreach ($context['top_topics_replies'] as $i => $topic)
 {
 $context['top_topics_replies'][$i]['post_percent'] = round(($topic['num_replies'] * 100) / $max_num_replies);
 $context['top_topics_replies'][$i]['num_replies'] = comma_format($context['top_topics_replies'][$i]['num_replies']);
 }
//smf.konusal.com En cok yanitlananlar top 10 Bitti
//smf.konusal.com En cok goruntulenenler top 10
 $topic_ids = array();
 $topic_view_result = $smcFunc['db_query']('', '
 SELECT m.subject, t.num_views, t.id_board, t.id_topic, b.name
 FROM {db_prefix}topics AS t
 INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
 INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
 AND b.id_board != {int:recycle_board}' : '') . ')
 WHERE {query_see_board}' . (!empty($topic_ids) ? '
 AND t.id_topic IN ({array_int:topic_list})' : ($modSettings['postmod_active'] ? '
 AND t.approved = {int:is_approved}' : '')) . '
 ORDER BY t.num_views DESC
 LIMIT 10',
 array(
 'topic_list' => $topic_ids,
 'recycle_board' => $modSettings['recycle_board'],
 'is_approved' => 1,
 )
 );
 $context['top_topics_views'] = array();
 $max_num_views = 1;
 while ($row_topic_views = $smcFunc['db_fetch_assoc']($topic_view_result))
 {
 censorText($row_topic_views['subject']);
 $context['top_topics_views'][] = array(
 'id' => $row_topic_views['id_topic'],
 'board' => array(
 'id' => $row_topic_views['id_board'],
 'name' => $row_topic_views['name'],
 'href' => $scripturl . '?board=' . $row_topic_views['id_board'] . '.0',
 'link' => '<a href="' . $scripturl . '?board=' . $row_topic_views['id_board'] . '.0">' . $row_topic_views['name'] . '</a>'
 ),
 'subject' => $row_topic_views['subject'],
 'num_views' => $row_topic_views['num_views'],
 'href' => $scripturl . '?topic=' . $row_topic_views['id_topic'] . '.0',
 'link' => '<a href="' . $scripturl . '?topic=' . $row_topic_views['id_topic'] . '.0">' . $row_topic_views['subject'] . '</a>'
 );

 if ($max_num_views < $row_topic_views['num_views'])
 $max_num_views = $row_topic_views['num_views'];
 }
 $smcFunc['db_free_result']($topic_view_result);

 foreach ($context['top_topics_views'] as $i => $topic)
 {
 $context['top_topics_views'][$i]['post_percent'] = round(($topic['num_views'] * 100) / $max_num_views);
 $context['top_topics_views'][$i]['num_views'] = comma_format($context['top_topics_views'][$i]['num_views']);
 }
// smf.konusal.com En cok goruntulenenler top 10 Bitti
// smf.konusal.com rastgele konu
 $rand = $smcFunc['db_query']('', '
 SELECT t.id_topic, m.subject, m.body
 FROM {db_prefix}topics AS t
 INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
 ORDER BY RAND()
 LIMIT {int:limit}',
 array(
 'limit' => 10,
 )
);

$context['top_topics_rand'] = array();
while ($rrow = $smcFunc['db_fetch_assoc']($rand))
 {
 censorText($rrow['subject']);
 $context['top_topics_rand'][] = array(
 'id' => $rrow['id_topic'],
 'subject' => $rrow['subject'],
 'href' => $scripturl . '?topic=' . $rrow['id_topic'] . '.0',
 'link' => '<a href="' . $scripturl . '?topic=' . $rrow['id_topic'] . '.0">' . $rrow['subject'] . '</a>'
 );

 
 }
 $smcFunc['db_free_result']($rand);

// smf.konusal.com rastgele konu Bitti


Temanızın yoksa defaultta/BoardIndex.template.php bul

Kod: lua
echo '
 <div id="boardindex_table">
 <table class="table_list">';

Üstüne Ekleyiniz.

Kod: lua
//top 10 http://smf.konusal.com 
 echo '<div class="atop10">
 <div class="cat_bar">
   <h3 class="catbg">
 ',$txt['forum_stats'],'
   </h3>
 </div>';
 
 echo '<div class="topresgele"><label class="topresgelelink">Rasgele Konular</label><div class="topres">';
 $say=0;foreach ($context['top_topics_rand'] as $ras)
 {$say++;echo '<p class="say'.$say.'">',$ras['link'], '</p>'; }
 echo '</div></div>
 <div class="toporta"><section class="tab-area tabs-checked">
 <input checked="checked" name="tab" id="tab-A" type="radio">
 <input name="tab" id="tab-B" type="radio">
 <input name="tab" id="tab-C" type="radio">

 <label class="tab-link" for="tab-A">En Son Yazılan</label>
 <label class="tab-link orta" for="tab-B">En Çok Cevaplanan</label>
 <label class="tab-link" for="tab-C">En Çok Görüntülenen</label>

 <article class="tab">';
    if (!empty($context['latest_posts']))
 $say=0;foreach ($context['latest_posts'] as $post)
 {$say++;echo '<p class="say'.$say.'"><a href="',$post['href'],'">', $post['short_subject'], '</a><span>', $post['poster']['link'],'</span></p>';}
    echo' </article><article class="tab">';
    $say=0;foreach ($context['top_topics_replies'] as $topic)
 {$say++;echo '<p class="say'.$say.'">', $topic['link'], '<span>', $topic['num_replies'], '</span></p>';}
    echo' </article><article class="tab">';
    $say=0;foreach ($context['top_topics_views'] as $topic)
 {$say++;echo '<p class="say'.$say.'">', $topic['link'], '<span>', $topic['num_views'], '</span></p>';}
    echo'</article></section></div>
 <div class="topson">
  <div class="tab-navigation">             
 <select id="select-box">
 <option value="1">En Çok Konu Açan Üye</option>
 <option value="2">En Çok Yazan Üye</option>
 <option value="3">En Yeni Üyeler</option>
 </select>
  </div>
  <div id="tab-1" class="tab-content">';
 $say=0;foreach ($context['top_starters'] as $poster)
 {$say++;echo '<p class="say'.$say.'">', $poster['link'], '<span>', $poster['num_topics'], '</span></p>';}
 echo'</div><div id="tab-2" class="tab-content">';
 $say=0;foreach ($context['top_posters'] as $poster)
 {$say++;echo '<p class="say'.$say.'">', $poster['link'], '<span>', $poster['num_posts'], '</span></p>'; }
 echo'</div><div id="tab-3" class="tab-content">';
 $say=0;foreach ($context['new_members'] as $poster)
 {$say++;echo '<p class="say'.$say.'">',$poster['link'], '</p>'; }
 echo'</div>
  </div>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
 <script>
 $(\'.tab-content\').hide();
 $(\'#tab-1\').show();
 $(\'#select-box\').change(function () {
   dropdown = $(\'#select-box\').val();
  $(\'.tab-content\').hide();
  $(\'#\' + "tab-" + dropdown).show();                                   
 });
 </script></div><br class="clear"/>';
//top 10 http://smf.konusal.com bitti


index.css de en alta ekle

Kod: lua
/* top 10 http://smf.konusal.com */
.atop10{width: 100%;}
.topresgele{width: 24%;
float: left;border: 1px solid #ccc;margin: 1px;min-height: 211px;}
.topresgelelink {font-size: 10px;cursor: pointer;color: #555;font-weight: bold;text-decoration: none;display: block;float: left;width: 100%;padding: 5px 0px;text-align: center;border-bottom: 1px solid #bbb;}
.topres{float: left;width: 100%;}
.toporta{width: 50%;float: left;border: 1px solid #ccc;margin: 1px;}
.topson{width: 24%;float: left;border: 1px solid #ccc;margin: 1px;min-height: 211px;}
.topresgele p,.toporta p,.topson p{border-bottom: 1px dashed #999;margin: 0px;padding: 0px 0px 0px 16px;}
.topresgele span,.toporta span,.topson span{float: right;}
.orta{border-left: 1px solid #ccc;border-right: 1px solid #ccc;}
.tab-area {width: 100%;float: left;}
.tab-area input { display: none;}
.tab-link {font-size: 10px;cursor: pointer;color: #555;font-weight: bold;text-decoration: none;display: block;float: left;width:  33%;padding: 5px 0;text-align: center;}
.tab-link:hover {background: #eee; color: #666;}
.tab {clear: both;padding: 2px;display: none; height: 180px;border-top: 1px solid #bbb;}

@media only screen and (max-width: 560px) {
  .tab-area {
    width: 100%;
    margin: 0 0 5%;
    float: left;
  }
  .intro {
    margin: 50px 0;
  }
}
.tabs-checked input:nth-of-type(2):not(:checked) ~ input:nth-of-type(3):not(:checked) ~ .tab:nth-of-type(1),
.tabs-checked input:nth-of-type(2):checked ~ .tab:nth-of-type(2),
.tabs-checked input:nth-of-type(3):checked ~ .tab:nth-of-type(3)
{
  display: block;
}
.tab-navigation { margin-bottom:2px; }
.tab-content {}
.tab-navigation select {width: 100%;border: 1px solid #ccc;padding: 4px;}
.say1{background:url(../images/top10/top1.gif) left no-repeat;}
.say2{background:url(../images/top10/top2.gif) left no-repeat;}
.say3{background:url(../images/top10/top3.gif) left no-repeat;}
.say4{background:url(../images/top10/top4.gif) left no-repeat;}
.say5{background:url(../images/top10/top5.gif) left no-repeat;}
.say6{background:url(../images/top10/top6.gif) left no-repeat;}
.say7{background:url(../images/top10/top7.gif) left no-repeat;}
.say8{background:url(../images/top10/top8.gif) left no-repeat;}
.say9{background:url(../images/top10/top9.gif) left no-repeat;}
.say10{background:url(../images/top10/top10.gif) left no-repeat;}
/* top 10 http://smf.konusal.com bitti*/

Vereceğim Linkteki top10 klasörünü komple temanızın images klasörüne atın
son olarak yönetim>yapılandırma>kullanılan tema kısmında Forum ana sayfasında gösterilecek son ileti sayısı: 10 yapın

İndirme Linki

Linki görebilmek için Kayıt olun yada Giriş yapın.
« Son Düzenleme: 14 Haziran 2018, 14:44:25 Gönderen: LJ »
 


MTASA TÜRK

[SimpleMachinesForum] Top 10 Eklentisi ve Kodlaması
« : 28 Şubat 2017, 21:39:52 »

Çevrimdışı CruzerGq

  • Süper Moderatör
  • *
    • İleti: 489
    • MTASATURK
Yanıtla #1 : 28 Şubat 2017, 21:51:55
Ders için teşekkürler.
 


Çevrimdışı Prose

  • Deneyimli Üye
  • *
    • İleti: 496
  • Gökhan Türkoglu
Yanıtla #2 : 28 Şubat 2017, 22:00:22
Eyw
 


Çevrimdışı Cynax

  • #
  • Uzman Üye
  • *
    • İleti: 525
  • Bıraktı
Yanıtla #3 : 01 Mart 2017, 19:04:59
Linki görebilmek için Kayıt olun yada Giriş yapın.
Ders için teşekkürler.
 


Çevrimdışı ByCash

  • Bilişim Teknolojileri
  • Süper Moderatör
  • *
    • İleti: 1006
  • C# - LUA
    • MTASATURK
Yanıtla #4 : 01 Mart 2017, 19:06:55
Yararlı bir konu.
 


Çevrimdışı Samsunlee

  • Acemi Üye
  • *
    • İleti: 167
Yanıtla #5 : 01 Mart 2017, 19:47:31
Tesekkurler
 


MTASA TÜRK

Ynt: [SimpleMachinesForum] Top 10 Eklentisi ve Kodlaması.
« Yanıtla #5 : 01 Mart 2017, 19:47:31 »

Çevrimdışı +LJ

  • Güverte İşletme
  • Moderatör
  • *
    • İleti: 367
  • #MustafaKemalAtatürk
Yanıtla #6 : 14 Haziran 2018, 14:45:21
Link kırık olduğu için, konunuz "Forum Çöplüğü"'ne taşınmıştır.
Linki görebilmek için Kayıt olun yada Giriş yapın.