[MOD] Similar Topics/Benzer başlıklar mod

Bilgisayar donanımları, kullanım kolaylıkları, yardım konuları ve teknolojik haberler.

[MOD] Similar Topics/Benzer başlıklar mod

İletigönderen DrunK » Pzt Şub 19, 2007 16:13

bu mod mesajlarinizin altinda, o forumla ilgili ona benzeyen başlıkları listeler..kurulması çok basit ve güzel kullanışlı bir mod tavsiye ederim :wink:

İm (Kod): Tümünü seç
##############################################################
## MOD Title: Similar Topics
## MOD Author: Leuchte < mail@leuchte.net > http://www.leuchte.net
## MOD Description: This mod adds a table at the bottom of a thread and displays other threads that are silimar in topic.
##
## MOD Version: 1.0.1
##
## Installation Level: kolay
## Installation Time: 2 dakika
## Files To Edit: 3
##
##         lang_main.php
##         viewtopic.php
##         templates/subSilver/viewtopic_body.tpl
##
## Included Files: 0
##############################################################
## For Security Purposes, Please Check: http://www.leuchte.net/mods/ for the
## latest version of this MOD.
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
## MOD History:
##
##   2004-09-25 - Initial Release
##
##############################################################
#
#-----[ SQL ]------------------------------------------
# Run the following command on your sql database (replace phpbb_ with your db prefix) before you edit the files!
ALTER TABLE phpbb_topics ADD FULLTEXT (topic_title);

#
#-----[ OPEN ]------------------------------------------
#
language/lang_turkish/lang_main.php

#
#-----[ FIND ]------------------------------------------
#
?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#
$lang['Similar'] = 'Benzer Başlıklar';

#
#-----[ aç ]------------------------------------------
#
viewtopic.php

#
#-----[ bul ]------------------------------------------
#
//
// Go ahead and pull all data for this topic
//

#
#-----[ önce, ekle ]------------------------------------------
#
// Similar Topics
$sql = "SELECT topic_id
FROM ". TOPICS_TABLE ."
WHERE topic_id != $topic_id
AND MATCH (topic_title) AGAINST ('". addslashes($topic_title) ."')
ORDER BY topic_time DESC LIMIT 0,5";
if ( !($result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, "Could not get main information for similar topics", '', __LINE__, __FILE__, $sql);
}
$topics = array();
while ( $row = $db->sql_fetchrow($result) )
{
  $topics[] = $row;
}
  $count_similar = count($topics);
if ( $count_similar > 0 )
{
  $template->assign_block_vars('similar', array(
         'L_SIMILAR' => $lang['Similar'],
         'L_TOPIC' => $lang['Topic'],
         'L_AUTHOR' => $lang['Author'],
         'L_FORUM' =>  $lang['Forum'],
         'L_REPLIES' => $lang['Replies'],
         'L_LAST_POST' => $lang['Posted'])
  );
 

for($i = 0; $i < $count_similar; $i++)
{
  $sql = "SELECT t.topic_type, t.topic_status, t.topic_id, t.topic_title, t.topic_time, t.topic_replies, t.topic_last_post_id, u.user_id, u.username, f.forum_id, f.forum_name, p.post_time, p.post_username
  FROM ". TOPICS_TABLE ." t, ". USERS_TABLE ." u, ". FORUMS_TABLE ." f, ". POSTS_TABLE ." p
  WHERE t.topic_id = '". $topics[$i]['topic_id'] ."'
  AND f.forum_id = t.forum_id
  AND p.topic_id = t.topic_id
  AND u.user_id = p.poster_id
  GROUP BY t.topic_id";
 if ( !($result = $db->sql_query($sql)) )
 {
     message_die(GENERAL_ERROR, "Could not get similar topics", '', __LINE__, __FILE__, $sql);
 }
 
  while ( $row = $db->sql_fetchrow($result) )
  {
   $similar = $row;
   
   $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_t']) : array();
   $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_f']) : array();
   $topic_type =  ( $similar['topic_type'] == POST_ANNOUNCE ) ? $lang['Topic_Announcement'] .' ': '';
    $topic_type .= ( $similar['topic_type'] == POST_STICKY ) ? $lang['Topic_Sticky'] .' ': '';
    $topic_type .= ( $similar['topic_vote'] ) ? $lang['Topic_Poll'] .' ': '';
   $replies = $similar['topic_replies'];
   
   if( $similar['topic_status'] == TOPIC_LOCKED )
   {
      $folder = $images['folder_locked'];
      $folder_new = $images['folder_locked_new'];
   }
   else if( $similar['topic_type'] == POST_ANNOUNCE )
   {
      $folder = $images['folder_announce'];
      $folder_new = $images['folder_announce_new'];
   }
   else if( $similar['topic_type'] == POST_GLOBAL_ANNOUNCE )
   {
      $folder = $images['folder_global_announce'];
      $folder_new = $images['folder_global_announce_new'];
   }
   else if( $similar['topic_type'] == POST_STICKY )
   {
      $folder = $images['folder_sticky'];
      $folder_new = $images['folder_sticky_new'];
   }
   else
   {
      if( $replies >= $board_config['hot_threshold'] )
      {
         $folder = $images['folder_hot'];
         $folder_new = $images['folder_hot_new'];
      }
      else
      {
         $folder = $images['folder'];
         $folder_new = $images['folder_new'];
      }
   }
  if( $userdata['session_logged_in'] )
   {
      if( $similar['post_time'] > $userdata['user_lastvisit'] )
      {
         if( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_f_all']) )
         {
            $unread_topics = true;
            if( !empty($tracking_topics[$topic_id]) )
            {
               if( $tracking_topics[$topic_id] >= $similar['post_time'] )
               {
                  $unread_topics = false;
               }
            }
            if( !empty($tracking_forums[$forum_id]) )
            {
               if( $tracking_forums[$forum_id] >= $similar['post_time'] )
               {
                  $unread_topics = false;
               }
            }
            if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_f_all']) )
            {
               if( $HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_f_all'] >= $similar['post_time'] )
               {
                  $unread_topics = false;
               }
            }

            if( $unread_topics )
            {
               $folder_image = $folder_new;
               $folder_alt = $lang['New_posts'];
               $newest_img = '<a href="'. append_sid("viewtopic.$phpEx?". POST_TOPIC_URL ."=$topic_id&view=newest") .'"><img src="'. $images['icon_newest_reply'] .'" alt="'. $lang['View_newest_post'] .'" title="'. $lang['View_newest_post'] .'" border="0" /></a> ';
            }
            else
            {
               $folder_image = $folder;
               $folder_alt = ( $similar['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
               $newest_img = '';
            }
         }
         else
         {
            $folder_image = $folder_new;
            $folder_alt = ( $similar['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['New_posts'];
            $newest_img = '<a href="'. append_sid("viewtopic.$phpEx?". POST_TOPIC_URL ."=$topic_id&view=newest") .'"><img src="'. $images['icon_newest_reply'] .'" alt="'. $lang['View_newest_post'] .'" title="'. $lang['View_newest_post'] .'" border="0" /></a> ';
         }
      }
      else
      {
         $folder_image = $folder;
         $folder_alt = ( $similar['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
         $newest_img = '';
      }
   }
   else
   {
      $folder_image = $folder;
      $folder_alt = ( $similar['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
      $newest_img = '';
   }

   $title = (strlen($similar['topic_title']) > 40) ? (substr($similar['topic_title'], 0, 37) . '...') : $similar['topic_title'];
   $topic_url = '<a href="'. append_sid("viewtopic.$phpEx?". POST_TOPIC_URL .'='. $similar['topic_id']) .'">'. $title . '</a>';

   $author_url = append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $similar['user_id']);

   $author = ( $similar['user_id'] != ANONYMOUS ) ? '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $similar['user_id']) .'">'. $similar['username'] .'</a>' : ( ($similar['post_username'] != '' ) ? $similar['post_username'] : $lang['Guest'] );
 
   $forum_url = append_sid("viewforum.$phpEx?f=". $similar['forum_id']);
   $forum = '<a href="'. $forum_url .'">'. $similar['forum_name'] .'</a>';
   $post_url = '<a href="'. append_sid("viewtopic.$phpEx?". POST_POST_URL .'='. $similar['topic_last_post_id']) .'#'. $similar['topic_last_post_id'] .'"><img src="'. $images['icon_latest_reply'] .'" alt="'. $lang['View_latest_post'] .'" title="'. $lang['View_latest_post'] .'" border="0" /></a>';
   $post_time = create_date($board_config['default_dateformat'], $similar['topic_time'], $board_config['board_timezone']);
 
    $template->assign_block_vars('similar.topics', array(
         'FOLDER' => $folder_image,
         'ALT' => $folder_alt,
         'TYPE' => $topic_type,
         'TOPICS' => $topic_url,
         'AUTHOR' => $author,
         'FORUM' => $forum,
         'REPLIES' => $replies,
         'NEWEST' => $newest_img,
         'POST_TIME' => $post_time,
         'POST_URL' => $post_url)
    );
  } // while
 } // for $i
} // if ( $count_similar > 0 )

#
#-----[ aç ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl

#
#-----[ bul ]------------------------------------------
#
   <td align="right" valign="top" nowrap="nowrap">{JUMPBOX}<span class="gensmall">{S_AUTH_LIST}</span></td>
  </tr>
</table>

#
#-----[ değiştir ]------------------------------------------
#
   <td align="right" valign="top" nowrap="nowrap">{JUMPBOX}<span class="gensmall">{S_AUTH_LIST}</span></td>
  </tr>
      <tr>
   <td width="100%" colspan="2" align="center">
   <br />
<!-- BEGIN similar -->
<table width="85%" cellspacing="1" cellpadding="4" border="0" align="center" class="forumline">
 <tr>
  <td class="catHead" colspan="6"><span class="genmed"><b>{similar.L_SIMILAR}</b></span></td>
 </tr>
 <tr>
  <th colspan="2">{similar.L_TOPIC}</th>
  <th>{similar.L_AUTHOR}</th>
  <th>{similar.L_FORUM}</th>
  <th>{similar.L_REPLIES}</th>
  <th>{similar.L_LAST_POST}</th>
 </tr>
 <!-- BEGIN topics -->
 <tr>
  <td class="row1" align="center"><span class="genmed"><img src="{similar.topics.FOLDER}" border="0" alt="{similar.topics.ALT}" title="{similar.topics.ALT}" /></span></td>
  <td class="row1" width="30%">{similar.topics.NEWEST}<span class="gensmall">{similar.topics.TYPE}</span> <span class="topictitle">{similar.topics.TOPICS}</span></td>
  <td class="row1" width="10%"><span class="genmed">{similar.topics.AUTHOR}</span></td>
  <td class="row1"><span class="genmed">{similar.topics.FORUM}</span></td>
  <td class="row1" width="15%" align="center"><span class="genmed">{similar.topics.REPLIES}</span></td>
  <td class="row1"><span class="genmed">{similar.topics.POST_TIME} {similar.topics.POST_URL}</span></td>
 </tr>
 <!-- END topics -->
</table>
<!-- END similar -->
   </td>
  </tr>
</table>

#
#-----[BÜTÜN DOSYALARI KAYDET VE KAPAT ]------------------------------------------
#
# EoM
v
Kullanıcı küçük betizi
DrunK
acımasız hayat
acımasız hayat
 
İletiler: 1312
Kayıt: Pzr Şub 18, 2007 2:15

İletigönderen ACD » Pzt Şub 19, 2007 16:18

PRENS, gercekten guzel bir mod, tesekkurler :wink:
Mevzubahis VATAN ise gerisi TEFERRUATTIR...!
Kullanıcı küçük betizi
ACD
Üye
Üye
 
İletiler: 1137
Kayıt: Pzr Şub 18, 2007 20:58

İletigönderen Ayberk » Cum Nis 20, 2007 19:39

PRENS, teşekkürler.
Kullanıcı küçük betizi
Ayberk
Üye
Üye
 
İletiler: 1400
Kayıt: Prş Mar 01, 2007 21:04


Şu dizine dön: Bilgisayar

Kİmler çevrİmİçİ

Bu dizini gezen kullanıcılar: Hiç kayıtlı kullanıcı yok ve 0 konuk

x