18 Ekim 2018, 20:07:06

Gönderen Konu: [SimpleMachinesForum] Top 10 Eklentisi ve Kodlaması  (Okunma sayısı 394 defa)

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Samsunlee

  • Acemi Üye
  • *
  • İleti: 184
[SimpleMachinesForum] Top 10 Eklentisi ve Kodlaması
« : 28 Şubat 2017, 21:39:52 »
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: Text
  1. $context['page_title'] = sprintf($txt['forum_index'], $context['forum_name']);

Altına Ekleyiniz.

 
Kod: Text
  1. global $context, $smcFunc, $txt, $scripturl, $modSettings;
  2. //smf.konusal.com En cok Konu acan top 10
  3. if (($members = cache_get_data('stats_top_starters', 360)) == null)
  4.  {
  5.  $request = $smcFunc['db_query']('', '
  6.  SELECT id_member_started, COUNT(*) AS hits
  7.  FROM {db_prefix}topics' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
  8.  WHERE id_board != {int:recycle_board}' : '') . '
  9.  GROUP BY id_member_started
  10.  ORDER BY hits DESC
  11.  LIMIT 10',
  12.  array(
  13.  'recycle_board' => $modSettings['recycle_board'],
  14.  )
  15.  );
  16.  $members = array();
  17.  while ($row = $smcFunc['db_fetch_assoc']($request))
  18.  $members[$row['id_member_started']] = $row['hits'];
  19.  $smcFunc['db_free_result']($request);
  20.  
  21.  cache_put_data('stats_top_starters', $members, 360);
  22.  }
  23.  
  24.  if (empty($members))
  25.  $members = array(0 => 0);
  26.  $members_result = $smcFunc['db_query']('', '
  27.  SELECT id_member, real_name
  28.  FROM {db_prefix}members
  29.  WHERE id_member IN ({array_int:member_list})
  30.  ORDER BY FIND_IN_SET(id_member, {string:top_topic_posters})
  31.  LIMIT 10',
  32.  array(
  33.  'member_list' => array_keys($members),
  34.  'top_topic_posters' => implode(',', array_keys($members)),
  35.  )
  36.  );
  37.  $context['top_starters'] = array();
  38.  $max_num_topics = 1;
  39.  while ($row_members = $smcFunc['db_fetch_assoc']($members_result))
  40.  {
  41.  $context['top_starters'][] = array(
  42.  'name' => $row_members['real_name'],
  43.  'id' => $row_members['id_member'],
  44.  'num_topics' => $members[$row_members['id_member']],
  45.  'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
  46.  'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
  47.  );
  48.  
  49.  if ($max_num_topics < $members[$row_members['id_member']])
  50.  $max_num_topics = $members[$row_members['id_member']];
  51.  if (!empty($modSettings['MemberColorStats']))
  52.  $context['MemberColor_ID_MEMBER'][$row_members['id_member']] = $row_members['id_member'];
  53.  }
  54.  $smcFunc['db_free_result']($members_result);
  55.  
  56.  foreach ($context['top_starters'] as $i => $topic)
  57.  {
  58.  $context['top_starters'][$i]['post_percent'] = round(($topic['num_topics'] * 100) / $max_num_topics);
  59.  $context['top_starters'][$i]['num_topics'] = comma_format($context['top_starters'][$i]['num_topics']);
  60.  }
  61. //smf.konusal.com En cok Konu acan top 10 Bitti
  62. //smf.konusal.com Yeni uyeler top 10
  63.    $members_result =  $smcFunc['db_query']('', '
  64.       SELECT id_member, real_name, posts
  65.       FROM {db_prefix}members
  66.       ORDER BY id_member DESC
  67.       LIMIT 10',
  68.       array(
  69.       )
  70.    );
  71.    $context['new_members'] = array();
  72.    while ($row_members = $smcFunc['db_fetch_assoc']($members_result))
  73.    {
  74.       $context['new_members'][] = array(
  75.          'name' => $row_members['real_name'],
  76.          'id' => $row_members['id_member'],
  77.          'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
  78.          'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
  79.       );
  80.    }
  81.    $smcFunc['db_free_result']($members_result);
  82. //smf.konusal.com Yeni uyeler top 10 bitti
  83. //smf.konusal.com En cok mesaj atan top 10.
  84.  $members_result = $smcFunc['db_query']('', '
  85.  SELECT id_member, real_name, posts
  86.  FROM {db_prefix}members
  87.  WHERE posts > {int:no_posts}
  88.  ORDER BY posts DESC
  89.  LIMIT 10',
  90.  array(
  91.  'no_posts' => 0,
  92.  )
  93.  );
  94.  $context['top_posters'] = array();
  95.  $max_num_posts = 1;
  96.  $context['MemberColor_ID_MEMBER'] = array();
  97.  while ($row_members = $smcFunc['db_fetch_assoc']($members_result))
  98.  {
  99.  $context['top_posters'][] = array(
  100.  'name' => $row_members['real_name'],
  101.  'id' => $row_members['id_member'],
  102.  'num_posts' => $row_members['posts'],
  103.  'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
  104.  'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
  105.  );
  106.  
  107.  if ($max_num_posts < $row_members['posts'])
  108.  $max_num_posts = $row_members['posts'];
  109.  if (!empty($modSettings['MemberColorStats']) && !empty($row_members['id_member']))
  110.  $context['MemberColor_ID_MEMBER'][$row_members['id_member']] = $row_members['id_member'];
  111.  }
  112.  $smcFunc['db_free_result']($members_result);
  113.  
  114.  foreach ($context['top_posters'] as $i => $poster)
  115.  {
  116.  $context['top_posters'][$i]['post_percent'] = round(($poster['num_posts'] * 100) / $max_num_posts);
  117.  $context['top_posters'][$i]['num_posts'] = comma_format($context['top_posters'][$i]['num_posts']);
  118.  }
  119. //smf.konusal.com En cok mesaj atan top 10 Bitti
  120. //smf.konusal.com En cok yanitlananlar top 10.
  121.  $topic_ids = array();
  122.  $topic_reply_result = $smcFunc['db_query']('', '
  123.  SELECT m.subject, t.num_replies, t.id_board, t.id_topic, b.name
  124.  FROM {db_prefix}topics AS t
  125.  INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
  126.  INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
  127.  AND b.id_board != {int:recycle_board}' : '') . ')
  128.  WHERE {query_see_board}' . (!empty($topic_ids) ? '
  129.  AND t.id_topic IN ({array_int:topic_list})' : ($modSettings['postmod_active'] ? '
  130.  AND t.approved = {int:is_approved}' : '')) . '
  131.  ORDER BY t.num_replies DESC
  132.  LIMIT 10',
  133.  array(
  134.  'topic_list' => $topic_ids,
  135.  'recycle_board' => $modSettings['recycle_board'],
  136.  'is_approved' => 1,
  137.  )
  138.  );
  139.  $context['top_topics_replies'] = array();
  140.  $max_num_replies = 1;
  141.  while ($row_topic_reply = $smcFunc['db_fetch_assoc']($topic_reply_result))
  142.  {
  143.  censorText($row_topic_reply['subject']);
  144.  
  145.  $context['top_topics_replies'][] = array(
  146.  'id' => $row_topic_reply['id_topic'],
  147.  'board' => array(
  148.  'id' => $row_topic_reply['id_board'],
  149.  'name' => $row_topic_reply['name'],
  150.  'href' => $scripturl . '?board=' . $row_topic_reply['id_board'] . '.0',
  151.  'link' => '<a href="' . $scripturl . '?board=' . $row_topic_reply['id_board'] . '.0">' . $row_topic_reply['name'] . '</a>'
  152.  ),
  153.  'subject' => $row_topic_reply['subject'],
  154.  'num_replies' => $row_topic_reply['num_replies'],
  155.  'href' => $scripturl . '?topic=' . $row_topic_reply['id_topic'] . '.0',
  156.  'link' => '<a href="' . $scripturl . '?topic=' . $row_topic_reply['id_topic'] . '.0">' .$row_topic_reply['subject'] . '</a>'
  157.  );
  158.  
  159.  if ($max_num_replies < $row_topic_reply['num_replies'])
  160.  $max_num_replies = $row_topic_reply['num_replies'];
  161.  }
  162.  $smcFunc['db_free_result']($topic_reply_result);
  163.  
  164.  foreach ($context['top_topics_replies'] as $i => $topic)
  165.  {
  166.  $context['top_topics_replies'][$i]['post_percent'] = round(($topic['num_replies'] * 100) / $max_num_replies);
  167.  $context['top_topics_replies'][$i]['num_replies'] = comma_format($context['top_topics_replies'][$i]['num_replies']);
  168.  }
  169. //smf.konusal.com En cok yanitlananlar top 10 Bitti
  170. //smf.konusal.com En cok goruntulenenler top 10
  171.  $topic_ids = array();
  172.  $topic_view_result = $smcFunc['db_query']('', '
  173.  SELECT m.subject, t.num_views, t.id_board, t.id_topic, b.name
  174.  FROM {db_prefix}topics AS t
  175.  INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
  176.  INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
  177.  AND b.id_board != {int:recycle_board}' : '') . ')
  178.  WHERE {query_see_board}' . (!empty($topic_ids) ? '
  179.  AND t.id_topic IN ({array_int:topic_list})' : ($modSettings['postmod_active'] ? '
  180.  AND t.approved = {int:is_approved}' : '')) . '
  181.  ORDER BY t.num_views DESC
  182.  LIMIT 10',
  183.  array(
  184.  'topic_list' => $topic_ids,
  185.  'recycle_board' => $modSettings['recycle_board'],
  186.  'is_approved' => 1,
  187.  )
  188.  );
  189.  $context['top_topics_views'] = array();
  190.  $max_num_views = 1;
  191.  while ($row_topic_views = $smcFunc['db_fetch_assoc']($topic_view_result))
  192.  {
  193.  censorText($row_topic_views['subject']);
  194.  $context['top_topics_views'][] = array(
  195.  'id' => $row_topic_views['id_topic'],
  196.  'board' => array(
  197.  'id' => $row_topic_views['id_board'],
  198.  'name' => $row_topic_views['name'],
  199.  'href' => $scripturl . '?board=' . $row_topic_views['id_board'] . '.0',
  200.  'link' => '<a href="' . $scripturl . '?board=' . $row_topic_views['id_board'] . '.0">' . $row_topic_views['name'] . '</a>'
  201.  ),
  202.  'subject' => $row_topic_views['subject'],
  203.  'num_views' => $row_topic_views['num_views'],
  204.  'href' => $scripturl . '?topic=' . $row_topic_views['id_topic'] . '.0',
  205.  'link' => '<a href="' . $scripturl . '?topic=' . $row_topic_views['id_topic'] . '.0">' . $row_topic_views['subject'] . '</a>'
  206.  );
  207.  
  208.  if ($max_num_views < $row_topic_views['num_views'])
  209.  $max_num_views = $row_topic_views['num_views'];
  210.  }
  211.  $smcFunc['db_free_result']($topic_view_result);
  212.  
  213.  foreach ($context['top_topics_views'] as $i => $topic)
  214.  {
  215.  $context['top_topics_views'][$i]['post_percent'] = round(($topic['num_views'] * 100) / $max_num_views);
  216.  $context['top_topics_views'][$i]['num_views'] = comma_format($context['top_topics_views'][$i]['num_views']);
  217.  }
  218. // smf.konusal.com En cok goruntulenenler top 10 Bitti
  219. // smf.konusal.com rastgele konu
  220.  $rand = $smcFunc['db_query']('', '
  221.  SELECT t.id_topic, m.subject, m.body
  222.  FROM {db_prefix}topics AS t
  223.  INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
  224.  ORDER BY RAND()
  225.  LIMIT {int:limit}',
  226.  array(
  227.  'limit' => 10,
  228.  )
  229. );
  230.  
  231. $context['top_topics_rand'] = array();
  232. while ($rrow = $smcFunc['db_fetch_assoc']($rand))
  233.  {
  234.  censorText($rrow['subject']);
  235.  $context['top_topics_rand'][] = array(
  236.  'id' => $rrow['id_topic'],
  237.  'subject' => $rrow['subject'],
  238.  'href' => $scripturl . '?topic=' . $rrow['id_topic'] . '.0',
  239.  'link' => '<a href="' . $scripturl . '?topic=' . $rrow['id_topic'] . '.0">' . $rrow['subject'] . '</a>'
  240.  );
  241.  
  242.  
  243.  }
  244.  $smcFunc['db_free_result']($rand);
  245.  
  246. // smf.konusal.com rastgele konu Bitti
  247.  
  248.  

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

Kod: Lua
  1. echo '
  2. <div id="boardindex_table">
  3. <table class="table_list">';

Üstüne Ekleyiniz.

Kod: Lua
  1. //top 10 http://smf.konusal.com
  2.  echo '<div class="atop10">
  3. <div class="cat_bar">
  4.   <h3 class="catbg">
  5. ',$txt['forum_stats'],'
  6.   </h3>
  7. </div>';
  8.  
  9.  echo '<div class="topresgele"><label class="topresgelelink">Rasgele Konular</label><div class="topres">';
  10.  $say=0;foreach ($context['top_topics_rand'] as $ras)
  11.  {$say++;echo '<p class="say'.$say.'">',$ras['link'], '</p>'; }
  12.  echo '</div></div>
  13. <div class="toporta"><section class="tab-area tabs-checked">
  14. <input checked="checked" name="tab" id="tab-A" type="radio">
  15. <input name="tab" id="tab-B" type="radio">
  16. <input name="tab" id="tab-C" type="radio">
  17.  
  18. <label class="tab-link" for="tab-A">En Son Yazılan</label>
  19. <label class="tab-link orta" for="tab-B">En Çok Cevaplanan</label>
  20. <label class="tab-link" for="tab-C">En Çok Görüntülenen</label>
  21.  
  22. <article class="tab">';
  23.     if (!empty($context['latest_posts']))
  24.  $say=0;foreach ($context['latest_posts'] as $post)
  25.  {$say++;echo '<p class="say'.$say.'"><a href="',$post['href'],'">', $post['short_subject'], '</a><span>', $post['poster']['link'],'</span></p>';}
  26.     echo' </article><article class="tab">';
  27.     $say=0;foreach ($context['top_topics_replies'] as $topic)
  28.  {$say++;echo '<p class="say'.$say.'">', $topic['link'], '<span>', $topic['num_replies'], '</span></p>';}
  29.     echo' </article><article class="tab">';
  30.     $say=0;foreach ($context['top_topics_views'] as $topic)
  31.  {$say++;echo '<p class="say'.$say.'">', $topic['link'], '<span>', $topic['num_views'], '</span></p>';}
  32.     echo'</article></section></div>
  33. <div class="topson">
  34.  <div class="tab-navigation">              
  35. <select id="select-box">
  36. <option value="1">En Çok Konu Açan Üye</option>
  37. <option value="2">En Çok Yazan Üye</option>
  38. <option value="3">En Yeni Üyeler</option>
  39. </select>
  40.  </div>
  41.  <div id="tab-1" class="tab-content">';
  42.  $say=0;foreach ($context['top_starters'] as $poster)
  43.  {$say++;echo '<p class="say'.$say.'">', $poster['link'], '<span>', $poster['num_topics'], '</span></p>';}
  44.  echo'</div><div id="tab-2" class="tab-content">';
  45.  $say=0;foreach ($context['top_posters'] as $poster)
  46.  {$say++;echo '<p class="say'.$say.'">', $poster['link'], '<span>', $poster['num_posts'], '</span></p>'; }
  47.  echo'</div><div id="tab-3" class="tab-content">';
  48.  $say=0;foreach ($context['new_members'] as $poster)
  49.  {$say++;echo '<p class="say'.$say.'">',$poster['link'], '</p>'; }
  50.  echo'</div>
  51.  </div>
  52. <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
  53. <script>
  54. $(\'.tab-content\').hide();
  55. $(\'#tab-1\').show();
  56. $(\'#select-box\').change(function () {
  57.   dropdown = $(\'#select-box\').val();
  58.  $(\'.tab-content\').hide();
  59.  $(\'#\' + "tab-" + dropdown).show();                                    
  60. });
  61. </script></div><br class="clear"/>';
  62. //top 10 http://smf.konusal.com bitti


index.css de en alta ekle

Kod: Lua
  1. /* top 10 http://smf.konusal.com */
  2. .atop10{width: 100%;}
  3. .topresgele{width: 24%;
  4. float: left;border: 1px solid #ccc;margin: 1px;min-height: 211px;}
  5. .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;}
  6. .topres{float: left;width: 100%;}
  7. .toporta{width: 50%;float: left;border: 1px solid #ccc;margin: 1px;}
  8. .topson{width: 24%;float: left;border: 1px solid #ccc;margin: 1px;min-height: 211px;}
  9. .topresgele p,.toporta p,.topson p{border-bottom: 1px dashed #999;margin: 0px;padding: 0px 0px 0px 16px;}
  10. .topresgele span,.toporta span,.topson span{float: right;}
  11. .orta{border-left: 1px solid #ccc;border-right: 1px solid #ccc;}
  12. .tab-area {width: 100%;float: left;}
  13. .tab-area input { display: none;}
  14. .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;}
  15. .tab-link:hover {background: #eee; color: #666;}
  16. .tab {clear: both;padding: 2px;display: none; height: 180px;border-top: 1px solid #bbb;}
  17.  
  18. @media only screen and (max-width: 560px) {
  19.   .tab-area {
  20.     width: 100%;
  21.     margin: 0 0 5%;
  22.     float: left;
  23.   }
  24.   .intro {
  25.     margin: 50px 0;
  26.   }
  27. }
  28. .tabs-checked input:nth-of-type(2):not(:checked) ~ input:nth-of-type(3):not(:checked) ~ .tab:nth-of-type(1),
  29. .tabs-checked input:nth-of-type(2):checked ~ .tab:nth-of-type(2),
  30. .tabs-checked input:nth-of-type(3):checked ~ .tab:nth-of-type(3)
  31. {
  32.   display: block;
  33. }
  34. .tab-navigation { margin-bottom:2px; }
  35. .tab-content {}
  36. .tab-navigation select {width: 100%;border: 1px solid #ccc;padding: 4px;}
  37. .say1{background:url(../images/top10/top1.gif) left no-repeat;}
  38. .say2{background:url(../images/top10/top2.gif) left no-repeat;}
  39. .say3{background:url(../images/top10/top3.gif) left no-repeat;}
  40. .say4{background:url(../images/top10/top4.gif) left no-repeat;}
  41. .say5{background:url(../images/top10/top5.gif) left no-repeat;}
  42. .say6{background:url(../images/top10/top6.gif) left no-repeat;}
  43. .say7{background:url(../images/top10/top7.gif) left no-repeat;}
  44. .say8{background:url(../images/top10/top8.gif) left no-repeat;}
  45. .say9{background:url(../images/top10/top9.gif) left no-repeat;}
  46. .say10{background:url(../images/top10/top10.gif) left no-repeat;}
  47. /* top 10 http://smf.konusal.com bitti*/
  48.  

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

Linkleri Görebilmek İçin Kayıt Olun veya Giriş Yapın
« Son Düzenleme: 14 Haziran 2018, 14:44:25 Gönderen: LJ »
 

MTASA-TURK | Türkiye'nin En Güncel MTA Platformu

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

CruzerGq

  • Süper Moderatör
  • *
  • İleti: 501
    • MTASATURK
Ynt: [SimpleMachinesForum] Top 10 Eklentisi ve Kodlaması.
« Yanıtla #1 : 28 Şubat 2017, 21:51:55 »
Ders için teşekkürler.
 

Prose

  • Deneyimli Üye
  • *
  • İleti: 478
  • Gökhan Türkoglu
Ynt: [SimpleMachinesForum] Top 10 Eklentisi ve Kodlaması.
« Yanıtla #2 : 28 Şubat 2017, 22:00:22 »
Eyw
 

Cynax

  • #
  • Uzman Üye
  • *
  • İleti: 540
  • Bıraktı
Ynt: [SimpleMachinesForum] Top 10 Eklentisi ve Kodlaması.
« Yanıtla #3 : 01 Mart 2017, 19:04:59 »
Linkleri Görebilmek İçin Kayıt Olun veya Giriş Yapın
Ders için teşekkürler.
 

ByCash

  • Süper Moderatör
  • *
  • İleti: 967
    • MTASATURK
Ynt: [SimpleMachinesForum] Top 10 Eklentisi ve Kodlaması.
« Yanıtla #4 : 01 Mart 2017, 19:06:55 »
Yararlı bir konu.
 

Samsunlee

  • Acemi Üye
  • *
  • İleti: 184
Ynt: [SimpleMachinesForum] Top 10 Eklentisi ve Kodlaması.
« Yanıtla #5 : 01 Mart 2017, 19:47:31 »
Tesekkurler
 

MTASA-TURK | Türkiye'nin En Güncel MTA Platformu

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

+LJ

  • Moderatör
  • *
  • İleti: 352
  • #MustafaKemalAtatürk
Ynt: [SimpleMachinesForum] Top 10 Eklentisi ve Kodlaması
« 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.