TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,965
  • Latest: boruko
Stats
  • Total Posts: 195,982
  • Total Topics: 21,320
  • Online today: 281
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online

Custom Recent Topics block.[2nd Update!]

Started by Megaforum, July 26, 2007, 11:59:21 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

celdric

#10
Hi. I just changed a line. I seperated it in the codebox. English isn't my mothertounge, sorry. So perhaps I messed it up.

//Custom Recent posts
//Made by Dragooon
global $scripturl, $db_prefix, $context, $smfFunc, $txt, $user_info, $modSettings;
//Main query
$result = db_query("
SELECT
m.id_msg, m.subject, m.body, t.id_topic, t.id_board,
b.name AS bname,m.id_member,b.memberGroups
FROM {$db_prefix}topics AS t, {$db_prefix}messages AS m, {$db_prefix}members AS mem, {$db_prefix}boards AS b
           






WHERE t.id_board = 31.0 AND b.id_board = 31.0









AND m.id_msg = t.id_first_msg
AND mem.id_member = m.id_member
AND b.memberGroups = b.memberGroups
AND $user_info[query_see_board]
AND ID_BOARD != $modSettings[recycle_board]
ORDER BY t.id_topic  DESC
LIMIT 5") or die(mysql_error());

while ($row = mysql_fetch_assoc($result))
{      //The variable which decides the MAX letters it can have.
$bodylen = 200;
// Limit the length of the message, if the option is set.
if (strlen(str_replace('<br />', "\n", $row['body'])) > $bodylen)
$row['body'] = htmlspecialchars(substr(str_replace('<br />', "\n", un_htmlspecialchars($row['body'])), 0, $bodylen-3) . '...', ENT_QUOTES);


censorText($row['body']);
censorText($row['subject']);

$context['rp'][] = array(
'title' => $row['subject'],
'link' => $scripturl . '?topic=' . $row['id_topic'] . '.0',
'description' => $row['body'],
'category' =>  $scripturl .'?board=' .$row['id_board'] . '.0',
'bname' => $row['bname']
);
}
foreach( $context['rp'] as $info)
echo'
<dt><br><a href="', $info['link'], '">', $info['title'], '</a></dt>
<dd>', $info['description'], '<br>posted in <a href ="',$info['category'],'">',$info['bname'],'</a></dd>
</dlv>';

This website is proudly hosted on Crocweb Cloud Website Hosting.