TinyPortal

Development => Block Codes => Topic started by: johnkal on June 08, 2009, 08:19:04 AM

Title: [Block] Number of replies at recent topics block
Post by: johnkal on June 08, 2009, 08:19:04 AM
Hi,

how can i make to show the number of replies at every topic?

I have attach a pic for example  :)

I find at TPortalBlocks.template.php this code but dont know how to make it ..


// TPortal recent topics block
function TPortal_recentbox()
{
global $context, $settings, $options, $txt , $modSettings;

    // is it a number?
if(!is_numeric($context['TPortal']['recentboxnum']))
$context['TPortal']['recentboxnum']='10';

// leave out the recycle board, if any
if(isset($modSettings['recycle_board']))
$bb=array($modSettings['recycle_board']);
else
$bb=array();

$what=ssi_recentTopics($num_recent = $context['TPortal']['recentboxnum'], $bb, $output_method = 'array');
// Output the topics
$counter=1; $cmax=count($what);
echo '
<div style="width: 100%; ' , $context['TPortal']['recentboxscroll']==1 ? 'overflow: auto; height: 20ex;' : '' , '">';
foreach($what as $w){
echo '
<div class="smalltext"><a href="'.$w['href'].'">'.$w['short_subject'].'</a></div>
<div class="smalltext">', $txt[525], ' <b>', $w['poster']['link'], '</b></div>
<div class="smalltext">';
if(!$w['new'])
echo '<a href="'.$w['href'].'"><img border="0" src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';

echo '['.$w['time'].']
</div>';

if($counter != $cmax)
echo '<hr />';
$counter++;
}
echo '

</div>';
}


thanks!!  :)
Title: Re: Number of replies at recent topics block
Post by: JPDeni on June 08, 2009, 12:48:32 PM
Put this in a php block:


global $context, $settings, $scripturl, $txt, $db_prefix, $ID_MEMBER;
global $user_info, $modSettings, $func;
$num_recent = 8;
$exclude_boards = null;
$output_method = 'echo';
if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
$exclude_boards = array($modSettings['recycle_board']);
else
$exclude_boards = empty($exclude_boards) ? array() : $exclude_boards;

$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$icon_sources = array();
foreach ($stable_icons as $icon)
$icon_sources[$icon] = 'images_url';

// Find all the posts in distinct topics.  Newer ones will have higher IDs.
$request = db_query("
SELECT
m.posterTime, ms.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG, b.ID_BOARD, b.name AS bName, t.numReplies,
IFNULL(mem.realName, m.posterName) AS posterName, " . ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) >= m.ID_MSG_MODIFIED AS isRead,
IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . ", LEFT(m.body, 384) AS body, m.smileysEnabled, m.icon
FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ms)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)" . (!$user_info['is_guest'] ? "
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = b.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)" : '') . "
WHERE t.ID_LAST_MSG >= " . ($modSettings['maxMsgID'] - 35 * min($num_recent, 5)) . "
AND t.ID_LAST_MSG = m.ID_MSG
AND b.ID_BOARD = t.ID_BOARD" . (empty($exclude_boards) ? '' : "
AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "
AND $user_info[query_see_board]
AND ms.ID_MSG = t.ID_FIRST_MSG
ORDER BY t.ID_LAST_MSG DESC
LIMIT $num_recent", __FILE__, __LINE__);
$posts = array();
while ($row = mysql_fetch_assoc($request))
{
$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']), array('<br />' => '
')));
if ($func['strlen']($row['body']) > 128)
$row['body'] = $func['substr']($row['body'], 0, 128) . '...';

// Censor the subject.
censorText($row['subject']);
censorText($row['body']);

if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

// Build the array.
$posts[] = array(
'topic' => $row['ID_TOPIC'],
'poster' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>',
'short_subject' => shorten_subject($row['subject'], 25),
'time' => timeformat($row['posterTime']),
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . ';topicseen#new',
'new' => !empty($row['isRead']),
'new_from' => $row['new_from'],
'replies' => $row['numReplies'],
);
}
mysql_free_result($request);

// Just return it.
$counter=1; $cmax=count($posts);
echo '
<div style="width: 100%;>';
foreach ($posts as $post)
{
echo '
<div class="smalltext"><a href="'.$post['href'].'">'.$post['short_subject'].'</a> (' . $post['replies'] . ')</div>
<div class="smalltext">', $txt[525], ' <b>', $post['poster'], '</b></div>
<div class="smalltext">';
if(!$post['new'])
echo '<a href="'.$post['href'].'"><img border="0" src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';

echo '[' . $post['time'] . ']
</div>';

if($counter != $cmax)
echo '<hr />';
$counter++;
}
echo '
</div>';
Title: Re: Number of replies at recent topics block
Post by: johnkal on June 09, 2009, 01:07:58 AM
Thanks for your answer :)

Quote from: JPDeni on June 08, 2009, 12:48:32 PM
Since the number of replies isn't part of the ssi_recentTopics function, you'll need to use a copy of that function with the added feature.

How?

i have try your code and i take this error..

QuoteParse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/xxxxx/public_html/Sources/Load.php(1777) : eval()'d code(35) : eval()'d code on line 53"
Title: Re: Number of replies at recent topics block
Post by: JPDeni on June 09, 2009, 01:21:01 AM
Quote
How?

By using the code I gave you.

I fixed the error. I'd left out a comma. :)
Title: Re: Number of replies at recent topics block
Post by: johnkal on June 10, 2009, 04:28:05 AM
With the new code the index.php don't load..!
I think it can't connect with the database to take the results of replies!
Title: Re: Number of replies at recent topics block
Post by: JPDeni on June 10, 2009, 05:32:06 AM
Try it now.
Title: Re: Number of replies at recent topics block
Post by: johnkal on June 11, 2009, 02:54:28 AM
wow! it works! thank you!!  :)
Title: Re: Number of replies at recent topics block
Post by: JPDeni on June 11, 2009, 05:16:43 AM
You're welcome. :) I'm not sure what the problem was, really. I redid the whole code and it finally worked right. I guess I got the magic right the second time. :)
Title: Re: [Block] Number of replies at recent topics block
Post by: Herr Inoddorell on June 12, 2009, 10:33:08 PM
The Code works excellent JP, but I would like that the "new.gif" were right after the replies count number. I tried to modify the code, but can't get it to work. Could someone help me with this, please?

This is the code I'm using:


global $context, $settings, $scripturl, $txt, $db_prefix, $ID_MEMBER;
global $user_info, $modSettings, $func;
$num_recent = 8;
$exclude_boards = null;
$output_method = 'echo';
if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
$exclude_boards = array($modSettings['recycle_board']);
else
$exclude_boards = empty($exclude_boards) ? array() : $exclude_boards;

$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$icon_sources = array();
foreach ($stable_icons as $icon)
$icon_sources[$icon] = 'images_url';

// Find all the posts in distinct topics.  Newer ones will have higher IDs.
$request = db_query("
SELECT
m.posterTime, ms.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG, b.ID_BOARD, b.name AS bName, t.numReplies,
IFNULL(mem.realName, m.posterName) AS posterName, " . ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) >= m.ID_MSG_MODIFIED AS isRead,
IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . ", LEFT(m.body, 384) AS body, m.smileysEnabled, m.icon
FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ms)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)" . (!$user_info['is_guest'] ? "
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = b.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)" : '') . "
WHERE t.ID_LAST_MSG >= " . ($modSettings['maxMsgID'] - 35 * min($num_recent, 5)) . "
AND t.ID_LAST_MSG = m.ID_MSG
AND b.ID_BOARD = t.ID_BOARD" . (empty($exclude_boards) ? '' : "
AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "
AND $user_info[query_see_board]
AND ms.ID_MSG = t.ID_FIRST_MSG
ORDER BY t.ID_LAST_MSG DESC
LIMIT $num_recent", __FILE__, __LINE__);
$posts = array();
while ($row = mysql_fetch_assoc($request))
{
$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']), array('<br />' => '
')));
if ($func['strlen']($row['body']) > 128)
$row['body'] = $func['substr']($row['body'], 0, 128) . '...';

// Censor the subject.
censorText($row['subject']);
censorText($row['body']);

if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

// Build the array.
$posts[] = array(
'topic' => $row['ID_TOPIC'],
'poster' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>',
'short_subject' => shorten_subject($row['subject'], 25),
'time' => timeformat($row['posterTime']),
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . ';topicseen#new',
'new' => !empty($row['isRead']),
'new_from' => $row['new_from'],
'replies' => $row['numReplies'],
);
}
mysql_free_result($request);

// Just return it.
$counter=1; $cmax=count($posts);
echo '
<div style="width: 100%; ' , $context['TPortal']['recentboxscroll']==1 ? 'overflow: auto; height: 20ex;' : '' , '">';
foreach ($posts as $post)
{
echo '
<div class="normal"><a href="'.$post['href'].'">'.$post['short_subject'].'</a></div>
                        <div class="smalltext">(' . $post['replies'] . ' Respuestas)</div>
<div class="smalltext">', $txt[525], ' <b>', $post['poster'], '</b></div>
<div class="smalltext">';
if(!$post['new'])
echo '<a href="'.$post['href'].'"><img border="0" src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';

echo '[' . $post['time'] . ']
</div>';

if($counter != $cmax)
echo '<hr />';
$counter++;
}
echo '
</div>';


Thanks in advance! ;)
Title: Re: [Block] Number of replies at recent topics block
Post by: JPDeni on June 12, 2009, 10:39:46 PM
This should work.

Replace


<div class="normal"><a href="'.$post['href'].'">'.$post['short_subject'].'</a></div>
                        <div class="smalltext">(' . $post['replies'] . ' Respuestas)</div>
<div class="smalltext">', $txt[525], ' <b>', $post['poster'], '</b></div>
<div class="smalltext">';
if(!$post['new'])
echo '<a href="'.$post['href'].'"><img border="0" src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';

echo '[' . $post['time'] . ']
</div>';


with



<div class="normal"><a href="'.$post['href'].'">'.$post['short_subject'].'</a></div>
                        <div class="smalltext">(' . $post['replies'] . ' Respuestas)';
if(!$post['new'])
echo '<a href="'.$post['href'].'"><img border="0" src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';
echo '
</div>
<div class="smalltext">', $txt[525], ' <b>', $post['poster'], '</b></div>
<div class="smalltext">';

echo '[' . $post['time'] . ']
</div>';
Title: Re: [Block] Number of replies at recent topics block
Post by: Herr Inoddorell on June 12, 2009, 10:48:24 PM
Thanks again JP! :). YOU ROCK! ;)
Title: Re: [Block] Number of replies at recent topics block
Post by: JPDeni on June 13, 2009, 01:14:57 AM
:) You're welcome.
Title: Re: [Block] Number of replies at recent topics block
Post by: Mick on July 16, 2009, 02:53:57 AM
Very cool,thanx JP!
Title: Re: [Block] Number of replies at recent topics block
Post by: Mick on July 16, 2009, 03:39:26 AM
JP,..... is it possible making the number of replies bold?

Like:


FireFox Users (19)
by BlueDevil
[Today at 07:05:52 PM]
Title: Re: [Block] Number of replies at recent topics block
Post by: JPDeni on July 16, 2009, 04:27:40 AM
Assuming you have the following construct in your code:


<div class="normal"><a href="'.$post['href'].'">'.$post['short_subject'].'</a></div>
                        <div class="smalltext">(' . $post['replies'] . ')';


change it to



<div class="normal"><a href="'.$post['href'].'">'.$post['short_subject'].'</a></div>
                        <div class="smalltext"><b>(' . $post['replies'] . ')</b>';


Just add html where you want it.
Title: Re: [Block] Number of replies at recent topics block
Post by: Mick on July 16, 2009, 10:56:10 PM
This is the code i have from your previous post. 

global $context, $settings, $scripturl, $txt, $db_prefix, $ID_MEMBER;
global $user_info, $modSettings, $func;
$num_recent = 7;
$exclude_boards = null;
$output_method = 'echo';
if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
$exclude_boards = array($modSettings['recycle_board']);
else
$exclude_boards = empty($exclude_boards) ? array() : $exclude_boards;

$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$icon_sources = array();
foreach ($stable_icons as $icon)
$icon_sources[$icon] = 'images_url';

// Find all the posts in distinct topics.  Newer ones will have higher IDs.
$request = db_query("
SELECT
m.posterTime, ms.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG, b.ID_BOARD, b.name AS bName, t.numReplies,
IFNULL(mem.realName, m.posterName) AS posterName, " . ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) >= m.ID_MSG_MODIFIED AS isRead,
IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . ", LEFT(m.body, 384) AS body, m.smileysEnabled, m.icon
FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ms)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)" . (!$user_info['is_guest'] ? "
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = b.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)" : '') . "
WHERE t.ID_LAST_MSG >= " . ($modSettings['maxMsgID'] - 35 * min($num_recent, 5)) . "
AND t.ID_LAST_MSG = m.ID_MSG
AND b.ID_BOARD = t.ID_BOARD" . (empty($exclude_boards) ? '' : "
AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "
AND $user_info[query_see_board]
AND ms.ID_MSG = t.ID_FIRST_MSG
ORDER BY t.ID_LAST_MSG DESC
LIMIT $num_recent", __FILE__, __LINE__);
$posts = array();
while ($row = mysql_fetch_assoc($request))
{
$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']), array('<br />' => '
')));
if ($func['strlen']($row['body']) > 128)
$row['body'] = $func['substr']($row['body'], 0, 128) . '...';

// Censor the subject.
censorText($row['subject']);
censorText($row['body']);

if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

// Build the array.
$posts[] = array(
'topic' => $row['ID_TOPIC'],
'poster' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>',
'short_subject' => shorten_subject($row['subject'], 25),
'time' => timeformat($row['posterTime']),
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . ';topicseen#new',
'new' => !empty($row['isRead']),
'new_from' => $row['new_from'],
'replies' => $row['numReplies'],
);
}
mysql_free_result($request);

// Just return it.
$counter=1; $cmax=count($posts);
echo '
<div style="width: 100%; ' , $context['TPortal']['recentboxscroll']==1 ? 'overflow: auto; height: 20ex;' : '' , '">';
foreach ($posts as $post)
{
echo '
<div class="smalltext"><a href="'.$post['href'].'">'.$post['short_subject'].'</a> (' . $post['replies'] . ')</div>
<div class="smalltext">', $txt[525], ' <b>', $post['poster'], '</b></div>
<div class="smalltext">';
if(!$post['new'])
echo '<a href="'.$post['href'].'"><img border="0" src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';

echo '[' . $post['time'] . ']
</div>';

if($counter != $cmax)
echo '<hr />';
$counter++;
}
echo '
</div>';



I dont see your new code in it :o
Title: Re: [Block] Number of replies at recent topics block
Post by: JPDeni on July 16, 2009, 11:27:45 PM
You want the number of replies and the parentheses around that number to be bold, yes?


<div class="smalltext"><a href="'.$post['href'].'">'.$post['short_subject'].'</a> (' . $post['replies'] . ')</div>


goes to


<div class="smalltext"><a href="'.$post['href'].'">'.$post['short_subject'].'</a> <b>(' . $post['replies'] . ')</b></div>


Just add the html.
Title: Re: [Block] Number of replies at recent topics block
Post by: Mick on July 16, 2009, 11:36:51 PM
Thanx JP,....that did it.   You rock! ;)
Title: Re: [Block] Number of replies at recent topics block
Post by: Mick on July 24, 2009, 12:03:00 AM
JP,....im using your code with the # of replies in "bold".


Just thought i'd let you know that it creates errors.   No biggie, as i learned to live with errors on my forum but wanted to let you know.

8: Undefined index: recentboxscroll
File: /home/*******/public_html/Themes/default/TPortalBlocks.template.php(35) : eval()'d code
Line: 67
Title: Re: [Block] Number of replies at recent topics block
Post by: JPDeni on July 24, 2009, 12:16:16 AM
Change

<div style="width: 100%; ' , $context['TPortal']['recentboxscroll']==1 ? 'overflow: auto; height: 20ex;' : '' , '">';


to


<div style="width: 100%; >';


Title: Re: [Block] Number of replies at recent topics block
Post by: Mick on July 24, 2009, 12:34:14 AM
Wow...... that did the trick.    Thank you. ;)
Title: Re: [Block] Number of replies at recent topics block
Post by: IchBin on October 01, 2009, 06:11:50 PM
$topic['num_replies'] and $topic['num_views'] are both available in that context.

You can add them where ever you'd like.
Title: Re: [Block] Number of replies at recent topics block
Post by: alhaudhie on October 10, 2009, 02:44:53 AM
its cant be done... can u send the complete one.. tq.. i have several times...
Title: Re: [Block] Number of replies at recent topics block
Post by: IchBin on October 10, 2009, 05:15:00 AM
Put this code right after the $what=ssi_recentTopics('20', NULL, 'array'); line. Please copy and paste the text that is displayed when you view the page after you have saved the change. You'll then want to remove this line.
echo '<pre>', print_r($what) ,'</pre>';
Title: Re: [Block] Number of replies at recent topics block
Post by: alhaudhie on October 10, 2009, 05:16:25 PM
Quote from: IchBinâ„¢ on October 10, 2009, 05:15:00 AM
Put this code right after the $what=ssi_recentTopics('20', NULL, 'array'); line. Please copy and paste the text that is displayed when you view the page after you have saved the change. You'll then want to remove this line.
echo '<pre>', print_r($what) ,'</pre>';

sorry coz i dont know what to do...
Title: Re: [Block] Number of replies at recent topics block
Post by: IchBin on October 10, 2009, 11:14:06 PM
Nevermind, I tested everything for you. Numreplies and Numviews is not available in the SSI unless you were to make modifications to the SSI.php file. If you don't want to do that, I would look for a code snippet that does what you want. If you don't care, then let us know and we'll let you know what changes you need to make to your file.
Title: Re: [Block] Number of replies at recent topics block
Post by: jebong on October 11, 2009, 12:06:35 AM
sorry.. coz im reg new acc coz wrong email change in profile.

back to the topic.. for me now.. better if i can get help to change ssi.php file . tq
Title: Re: [Block] Number of replies at recent topics block
Post by: IchBin on October 12, 2009, 03:09:22 AM
Open SSI.php and find your way to the recentTopics function.

Find this code:
m.posterTime, ms.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG, b.ID_BOARD, b.name AS bName,

Replace with this code:
m.posterTime, ms.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG, b.ID_BOARD, b.name AS bName, t.numViews, t.numReplies,

Find this code:
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',

Add after that line:
'numViews' => $row['numViews'],
'numReplies' => $row['numReplies'],


Now you can use $topic['numViews'] and $topic['numReplies'] in your code to get those numbers.
Title: Re: [Block] Number of replies at recent topics block
Post by: jebong on October 13, 2009, 04:11:30 PM
TQ.. got it with litle editing. TQ

Now im trying to put msg icon... can i? and how to put it?  i mean post topic icon.. hot topic - very hot topic and etc..

Title: Re: [Block] Number of replies at recent topics block
Post by: IchBin on October 14, 2009, 12:47:47 AM
I'm not sure how the icon's are created at the moment, but I do know that $topic['icon'] is available in this code.
Title: Re: [Block] Number of replies at recent topics block
Post by: alhaudhie on October 14, 2009, 03:58:46 PM
Quote from: IchBinâ„¢ on October 14, 2009, 12:47:47 AM
I'm not sure how the icon's are created at the moment, but I do know that $topic['icon'] is available in this code.

sorry... but i think after checking the sample file.. i find

'is_sticky' => !empty($modSettings['enableStickyTopics']) && !empty($row['isSticky']),
'is_locked' => !empty($row['locked']),
'is_poll' => $modSettings['pollMode'] == '1' && $row['ID_POLL'] > 0,
'is_hot' => $row['numReplies'] >= $modSettings['hotTopicPosts'],
'is_very_hot' => $row['numReplies'] >= $modSettings['hotTopicVeryPosts'],
'is_posted_in' => false,


and

// Do we want to seperate the sticky and lock status out?
if (!empty($settings['seperate_sticky_lock']) && strpos($topic['class'], 'sticky') !== false)
$topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_sticky'));
if (!empty($settings['seperate_sticky_lock']) && strpos($topic['class'], 'locked') !== false)
$topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_locked'));

echo '
<tr>
<td class="windowbg2" valign="middle" align="center" width="6%">
<img src="' . $settings['images_url'] . '/topic/' . $topic['class'] . '.gif" alt="" />
</td><td class="windowbg2" valign="middle" align="center" width="4%">
<img src="' . $topic['first_post']['icon_url'] . '" alt="" align="middle" />
</td><td class="windowbg' , $topic['is_sticky'] && !empty($settings['seperate_sticky_lock']) ? '3' : '' , '" width="48%" valign="middle">' , $topic['is_locked'] && !empty($settings['seperate_sticky_lock']) ? '
<img src="' . $settings['images_url'] . '/icons/quick_lock.gif" align="right" alt="" style="margin: 0;" />' : '' , $topic['is_sticky'] && !empty($settings['seperate_sticky_lock']) ? '
<img src="' . $settings['images_url'] . '/icons/show_sticky.gif" align="right" alt="" style="margin: 0;" />' : '', $topic['first_post']['link'];
if ($topic['new'] == 0)


i dont know anything.. but i think thats code is related to put the topic icon. tq

what code must i add in ssi.php?