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,970
  • Latest: bynw
Stats
  • Total Posts: 196,048
  • Total Topics: 21,337
  • Online today: 230
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 117
  • Total: 118
  • lurkalot

Post in a block?

Started by Avinash, October 15, 2006, 12:43:27 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Avinash

Hey, is there any way to put just one post in a block? Whenever the post is edited, so will the block.

jacortina

Here you go (put in php block and put the post's message number where indicated):

global $scripturl, $db_prefix, $settings, $modSettings, $context;

//////////////////// Enter message # here
$message_id =  1234;

$message_id = (int) $message_id;
$request = db_query("
SELECT m.icon, m.subject, m.body, IFNULL(mem.realName, m.posterName) AS posterName,
m.posterTime, m.ID_MSG, t.ID_TOPIC, m.ID_MEMBER, m.smileysEnabled, b.name
FROM ({$db_prefix}topics AS t, {$db_prefix}messages AS m, {$db_prefix}boards as b)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE m.ID_MSG = $message_id
AND m.ID_TOPIC = t.ID_TOPIC
AND t.ID_BOARD = b.ID_BOARD"
, __FILE__, __LINE__);

$return = array();

if (mysql_num_rows($request) == 0) return;

$row = mysql_fetch_assoc($request);
$row['body'] = doUBBC($row['body'], $row['smileysEnabled']);

$return[] = array(
'icon' => '<img src="' . $settings['images_url'] . '/post/' . $row['icon'] . '.gif" align="middle" valign="top" alt="' . $row['icon'] . '" />',
'subject' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#msg' . $row['ID_MSG'] . '">'.$row['subject'].'</a>',
'time' => timeformat($row['posterTime']),
'body' => $row['body'],
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0',
'poster' => array(
'id' => $row['ID_MEMBER'],
'name' => $row['posterName'],
'href' => !empty($row['ID_MEMBER']) ? $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] : '',
'link' => !empty($row['ID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>' : $row['posterName']
),
);
mysql_free_result($request);

foreach ($return as $news)
echo '
<table border="0" width="100%" align="center" class="smfNews">
<tr><td>', $news['icon'], ' <b>', $news['subject'], '</b><span class="smaller"><br />', $news['time'], ' - ', $news['poster']['link'], '<br /><br /></span></td></tr>
<tr><td>', $news['body'], '<br /></td></tr>
</table>';

Avinash


This website is proudly hosted on Crocweb Cloud Website Hosting.