Seite 1 von 1

Advanced Topic Types auch in den Suchergebnissen

Verfasst: 06.04.2005 07:54
von Zöllner
Hallo zusammen,

ich habe vor ein paar Tagen den Advanced Topic Type MOD installiert. Soweit funktioniert alles super, allerdings hätte ich gerne die Topic Types auch in den Ergebnissen der Suchfunktion dargestellt.

Hat jemand vielleicht schonmal daran gebastelt? Welche Änderungen sind in der search.php erforderlich?

In der viewforum.php waren eine ganze Menge Änderungen zu machen:

Code: Alles auswählen

#
#-----[ OPEN ]----------------------------------------------
#

viewforum.php

#-----[ FIND ]----------------------------------------------
#

    AND t.topic_type <> " . POST_ANNOUNCE . "

#
#-----[ REPLACE WITH ]----------------------------------------------
#

    AND t.topic_type = " . POST_STICKY . " 

#-----[ FIND ]----------------------------------------------
#

  $total_topics++;
}

$db->sql_freeresult($result);

#
#-----[ AFTER, ADD ]----------------------------------------------
#

// BEGIN Advanced Topic Type MOD

//
// All topic types added
//
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time 
  FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
  WHERE t.forum_id = $forum_id
  AND t.topic_poster = u.user_id
  AND p.post_id = t.topic_first_post_id
  AND p2.post_id = t.topic_last_post_id
  AND u2.user_id = p2.poster_id 
  AND t.topic_type > " . POST_GLOBAL_ANNOUNCE . " 
  AND t.topic_type_active = 1
  $limit_topics_time
  ORDER BY t.topic_type DESC, t.topic_last_post_id DESC 
  LIMIT $start, ".$board_config['topics_per_page'];

if ( !($result = $db->sql_query($sql)) )
{
  message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}

$total_add_types = 0;
while( $row = $db->sql_fetchrow($result) )
{
  $topic_rowset[] = $row;
  $total_add_types++;
}

$db->sql_freeresult($result);

//
// All normal posts and inactive topic types
//
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time 
  FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
  WHERE t.forum_id = $forum_id
  AND t.topic_poster = u.user_id
  AND p.post_id = t.topic_first_post_id
  AND p2.post_id = t.topic_last_post_id
  AND u2.user_id = p2.poster_id 
  AND ( (t.topic_type > ". POST_GLOBAL_ANNOUNCE ." AND t.topic_type_active = 0 ) OR t.topic_type = " . POST_NORMAL . " )
  $limit_topics_time
  ORDER BY t.topic_last_post_id DESC 
  LIMIT $start, ".$board_config['topics_per_page'];

if ( !($result = $db->sql_query($sql)) )
{
  message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}

$total_non_active = 0;
while( $row = $db->sql_fetchrow($result) )
{
  $topic_rowset[] = $row;
  $total_non_active++;
}

$db->sql_freeresult($result);
// END Advanced Topic Type MOD

#-----[ FIND ]----------------------------------------------
#

$total_topics += $total_announcements;

#
#-----[ AFTER, ADD ]----------------------------------------------
#

// BEGIN Advanced Topic Type MOD
$total_topics += $total_add_types;
$total_topics += $total_non_active;
// END Advanced Topic Type MOD

#-----[ FIND ]----------------------------------------------
#

//
// Okay, lets dump out the page ...
//

#
#-----[ AFTER, ADD ]----------------------------------------------
#

// BEGIN Advanced Topic Type MOD
$sql = "SELECT t.*, t1.topic_type_color AS announce_color, t2.topic_type_color AS sticky_color
  FROM ". TOPIC_ADD_TYPE_TABLE ." t,". TOPIC_ADD_TYPE_TABLE ." t1, ". TOPIC_ADD_TYPE_TABLE ." t2
  WHERE t1.topic_type_name = 'announce'
  AND t2.topic_type_name = 'sticky'";
  
if ( !($result = $db->sql_query($sql)) )
{
  message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}
while ($tt_row = $db->sql_fetchrow($result))
{
  $row[] = $tt_row;
  $announce_color = '#'.$tt_row['announce_color'];
  $sticky_color = '#'.$tt_row['sticky_color'];
}
// END Advanced Topic Type MOD

#-----[ FIND ]----------------------------------------------
#

    if( $topic_type == POST_ANNOUNCE )
    {
      $topic_type = $lang['Topic_Announcement'] . ' ';
    }
    else if( $topic_type == POST_STICKY )
    {
      $topic_type = $lang['Topic_Sticky'] . ' ';
    }

#
#-----[ REPLACE WITH ]----------------------------------------------
#

    // BEGIN Advanced Topic Type MOD
    if( $topic_type == POST_ANNOUNCE )
    {
      $topic_type = '<span style="color:'. $announce_color .'">'. $lang['Topic_Announcement'] . ' </span>';
    }
    else if( $topic_type == POST_STICKY )
    {
      $topic_type = '<span style="color:'. $sticky_color .'">'. $lang['Topic_Sticky'] . ' </span>';
    }
    else if( $topic_type > POST_GLOBAL_ANNOUNCE )
    {
      for($j = 0; $j < count($row); $j++ )
      {
        if( intval($topic_rowset[$i]['topic_type'] - POST_ADD_TYPE) == $row[$j]['topic_type_order'] )
        {
          $topic_type = '<span style="color:#'. $row[$j]['topic_type_color'] .'">'. $row[$j]['topic_type_name'] .':</span> ';      
        }
      }  
    }
    // END Advanced Topic Type MOD

#-----[ FIND ]----------------------------------------------
#

      if( $topic_rowset[$i]['topic_type'] == POST_ANNOUNCE )
      {
        $folder = $images['folder_announce'];
        $folder_new = $images['folder_announce_new'];
      }

#
#-----[ AFTER, ADD ]----------------------------------------------
#

      // BEGIN Advanced Topic Type MOD
      else if( $topic_rowset[$i]['topic_type'] > POST_ADD_TYPE )
      {
        if( $row[$i]['topic_type_image'] != '' )
        {
          $folder = $row[$i]['topic_type_image'];
          $folder_new = $row[$i]['topic_type_image_new'];
        }
        else
        {  
          $folder = $images['folder_topic_type'];
	  $folder_new = $images['folder_topic_type_new'];
        }
      }
      // END Advanced Topic Type MOD
Danke für die Hilfe,

MARC

Verfasst: 19.06.2005 23:23
von Gumfuzi
ja, ich suche auch diese zusätzliche Funktion...

Hat da jemand Tipps dafür?