global $smcFunc, $scripturl; $columns = 2; // $boards = array(1, 2, 3 ,4 ,5 ,6 ,7 ,8 ,9 ,10 ,11 ,12 ,13 ,14 ,15 ,16 ,17 ,18 ,19 ,20 ,21); $request = $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) WHERE t.id_board IN ({array_int:boards}) ORDER BY m.poster_time DESC LIMIT {int:limit}', array( 'boards' => $boards, 'limit' => 4, ) ); $topics = array(); while ($row = $smcFunc['db_fetch_assoc']($request)) $topics[] = array( 'id_topic' => $row['id_topic'], 'body' => $row['body'], 'first_image' => preg_match_all('~\[img\]([^\]]+)\[\/img\]~i', $row['body'], $images) ?'<center>' . $row['subject'] . '</center>' . '<img src="' . $images[1][0]. ' "height="640" width="452" />' : '', ); $smcFunc['db_free_result']($request); echo ' <center> <table> <tr> <td width="120%"> </center> <table> <tr>'; $counter = 0; foreach ($topics as $topic) { if ($counter != 0 && $counter % $columns == 0) { echo ' </tr> <tr>'; } echo ' <td> <a href="', $scripturl, '?topic=', $topic['id_topic'], '.0">', $topic['first_image'], '<br /><td><td><td><td><td><span>', $topic['subject'], '</span></a></td></td> </td></td></td>'; $counter++; } echo ' </tr> </table> </td> </tr> </table>'; |