Post text inplaats van topic titel

Installatie lukt niet? Plotseling een foutmelding. Of weet je niet hoe iets werkt. Problemen met phpBB2 kun je in dit archief opzoeken.
Forumregels

Sinds 1 januari 2009 wordt phpBB2 niet meer ondersteund.
Onderstaande informatie is verouderd en dient uitsluitend als archief.
phpBB2.0.x
Gesloten
Inward
Berichten: 99
Lid geworden op: 07 feb 2004, 13:46

Post text inplaats van topic titel

Bericht door Inward » 22 mar 2005, 17:54

Hoi,
Ik gebruik het script hieronder om de de laatste reacties te krijgen. Maar die worden weergegeven als de topic titel. Nouw wil ik graag dat de text in die laatste reactie wordt wergeven, en dus niet de topic titel. Maar hoe doe ik dat?

Code: Selecteer alles

$sql = "SELECT * FROM ". FORUMS_TABLE . " ORDER BY forum_id"; 
if (!$result = $db->sql_query($sql)) 
{ 
   message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql); 
} 
$forum_data = array(); 
while( $row = $db->sql_fetchrow($result) ) 
{ 
   $forum_data[] = $row; 
} 

$is_auth_ary = array(); 
$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata, $forum_data); 

if( $CFG['exceptional_forums'] == '' ) 
{ 
   $except_forum_id = '\'start\''; 
} 
else 
{ 
   $except_forum_id = $CFG['exceptional_forums']; 
} 

for ($i = 0; $i < count($forum_data); $i++) 
{ 
   if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view'])) 
   { 
      if ($except_forum_id == '\'start\'') 
      { 
         $except_forum_id = $forum_data[$i]['forum_id']; 
      } 
      else 
      { 
         $except_forum_id .= ',' . $forum_data[$i]['forum_id']; 
      } 
   } 
} 
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username 
      FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u 
      WHERE t.forum_id NOT IN (" . $except_forum_id . ") 
         AND t.topic_status <> 2 
         AND p.post_id = t.topic_last_post_id 
         AND p.poster_id = u.user_id 
      ORDER BY p.post_id DESC 
      LIMIT " . $CFG['number_recent_topics']; 
if (!$result = $db->sql_query($sql)) 
{ 
   message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql); 
} 
$number_recent_topics = $db->sql_numrows($result); 
$recent_topic_row = array(); 
while ($row = $db->sql_fetchrow($result)) 
{ 
   $recent_topic_row[] = $row; 
} 
for ($i = 0; $i < $number_recent_topics; $i++) 
{ 
   $template->assign_block_vars('recent_topic_row', array( 
      'U_TITLE' => append_sid("http://www.inward.nl/viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#' .$recent_topic_row[$i]['post_id'], 
      'L_TITLEE' => $recent_topic_row[$i]['topic_title'], 
      'L_TITLE' => (strlen($recent_topic_row[$i]['topic_title']) > 30) ? rtrim(substr($recent_topic_row[$i]['topic_title'], 0, 28)) . '...' : $recent_topic_row[$i]['topic_title'],
      'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $recent_topic_row[$i]['user_id']), 
      'S_POSTER' => $recent_topic_row[$i]['username'], 
      'S_POSTTIME' => mktime(0, 0, 0, date('n'), date('j'), date('Y')) < $recent_topic_row[$i]['post_time'] ? create_date("H:i" , $recent_topic_row[$i]['post_time'], $board_config['board_timezone']) : create_date("d/m" , $recent_topic_row[$i]['post_time'], $board_config['board_timezone'])
      ) 
   ); 
} 

Inward
Berichten: 99
Lid geworden op: 07 feb 2004, 13:46

Bericht door Inward » 22 mar 2005, 18:28

Ik dacht zelf zoiets:

Code: Selecteer alles

$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username 
      FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u 
veranderen in

Code: Selecteer alles

$sql = "SELECT t.topic_id, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username, pt.post_text 
      FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u, " . POSTS_TEXT_TABLE . " AS pt 
en

Code: Selecteer alles

'L_TITLE' => (strlen($recent_topic_row[$i]['topic_title']) > 30) ? rtrim(substr($recent_topic_row[$i]['topic_title'], 0, 28)) . '...' : $recent_topic_row[$i]['topic_title'], 
veranderen naar:

Code: Selecteer alles

      
'L_TITLE' => (strlen($recent_topic_row[$i]['post_text']) > 30) ? rtrim(substr($recent_topic_row[$i]['post_text'], 0, 28)) . '...' : $recent_topic_row[$i]['post_text'],
Maar als ik dit verander, upload en het vervolgens wil bekijken moet ik lang wachten en wachten.. Dus er is is nog niets fout, maar wat?

Gesloten