So this is a mod that was created by Freddy. I would like to know how I can show the last post time to this code. The area where the "last post time" should be displayed has to be right before the "last poster"
// *************
// The Functions
// *************
// Grabs recent topics...
function mot_NewTopics()
{
global $scripturl, $settings, $context, $txt;
$what = ssi_recentTopics('15',NULL,'array');
echo '
<div class="tabsmenucontent" style="padding: 5px">
<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">
<tr class="catbg3">
<td valign="middle"></td>
</tr>';
foreach ($what as $topic)
{
echo '
<tr>
<td class="windowbg" valign="middle">', $topic['link'];
// Is this topic new? (assuming they are logged in!)
if (!$topic['new'] && $context['user']['is_logged'])
echo '
<a href="', $scripturl, '?topic=', $topic['topic'], '.from', $topic['time'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="new" border="0" /></a>';
echo '
</td>
<td class="windowbg2" valign="middle">', $topic['poster']['link'], '</td>
<td class="windowbg2" valign="middle">';
if ($settings['images_url'] != $settings['theme_url'] . '/images' || file_exists($settings['theme_dir'] . '/images/icons/last_post.gif'))
echo '
<a href="', $topic['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="Last Post" title="Last Post" border="0" style="float: right;" /></a>';
}
echo '
</td>
</tr>
</table>
</div>';
}
Thanks in advance
$what['time] should have the time of the post. You should be able to put that in the HTML where ever you need it.
That simple ha? Man! I really need to learn coding but hey I'm catching up as I've gone from scratch to running a successful forum :)
Well all you have to do is to look at the function in SSI.php. Scroll down until you see what is in the array that it is creating.
You can see what is available when the function is called.
// Build the array.
$posts[] = array(
'board' => array(
'id' => $row['id_board'],
'name' => $row['board_name'],
'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>'
),
'topic' => $row['id_topic'],
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'
),
'subject' => $row['subject'],
'replies' => $row['num_replies'],
'views' => $row['num_views'],
'short_subject' => shorten_subject($row['subject'], 25),
'preview' => $row['body'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#new',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#new" rel="nofollow">' . $row['subject'] . '</a>',
// Retained for compatibility - is technically incorrect!
'new' => !empty($row['is_read']),
'is_new' => empty($row['is_read']),
'new_from' => $row['new_from'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" />',
);
Sorry for the trouble Ich but as you know I'm a utter noob at this and support forums are all I depend on anyways so here is my code ->
function mot_NewTopics1()
{
global $scripturl, $settings, $context, $txt;
$what = ssi_recentTopics('15', array(2,30,4,3,5,39,40,42,43,45,41,6,34,33,35,25,32,36,17,8,11,10,9,12,15,14,13,20,37,31,29,38,16,19,27,24),'array');
echo '
<div class="tabsmenucontent" style="padding: 5px">
<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">
<tr class="catbg3">
<td valign="middle"></td>
</tr>';
foreach ($what as $topic)
{
echo '
<tr>
<td class="windowbg" valign="middle">', $topic['link'];
// Is this topic new? (assuming they are logged in!)
if (!$topic['new'] && $context['user']['is_logged'])
echo '
<a href="', $scripturl, '?topic=', $topic['topic'], '.from', $topic['time'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="new" border="0" /></a>';
echo '
</td>
<td class="windowbg2" valign="middle">', $topic['poster']['link'], '</td>
<td class="windowbg2" valign="middle">';
if ($settings['images_url'] != $settings['theme_url'] . '/images' || file_exists($settings['theme_dir'] . '/images/icons/last_post.gif'))
echo '
<a href="', $topic['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="Last Post" title="Last Post" border="0" style="float: right;" /></a>';
}
echo '
</td>
</tr>
</table>
</div>';
}
I placed the $what['time] function like this:
<td class="windowbg2" valign="middle">', $what['time] '</td>
It didn't seem to work. Could you be generous enough to tell me how and where it should be placed amongst my code, sir.
I'd appreciate it greatly.
My site URL: http://www.superheroalliance.net
I realize I made a mistake in the code I posted which you seemed to copy lol, but do you see the difference between this?
$what['time]
And this?
$what['time']
Quote from: IchBinâ,,¢ on April 09, 2011, 11:10:14 PM
I realize I made a mistake in the code I posted which you seemed to copy lol
Coz I'm stupid like that.
Anyways this is my line:
<td class="windowbg2" valign="middle">', $what['time'], '</td>Still not displaying time? :/
Try :
<td class="windowbg2" valign="middle">', $topic['time'], '</td>
Wooooooooohoooooooooooooooo!!!! FREDDY!!!!! You the man!!
Also thanks Ichi..... You guys rule.....
Please mark topic as solved
Haha, welcome :)