Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

November 30, 2022, 02:26:46 PM

Login with username, password and session length
Members
  • Total Members: 3853
  • Latest: tty456
Stats
  • Total Posts: 193625
  • Total Topics: 21107
  • Online today: 70
  • Online ever: 3540
  • (September 02, 2022, 06:38:54 PM)
Users Online
Users: 0
Guests: 48
Total: 48

Author Topic: [Discussion] Recent topics table with hover over previews.  (Read 87505 times)

0 Members and 1 Guest are viewing this topic.

Offline lurkalot

  • Administrator
  • *
  • Posts: 7415
    • Camera Craniums
Re: [Discussion] Recent topics table with hover over previews.
« Reply #150 on: June 14, 2011, 12:51:52 AM »
Here's the one I use, Brad has already converted it for me.  O0

Code: [Select]
// *********************************************************************
// A PHP block by Freddy888 and MrCare
// !!Modified to show icon, number of views and replies.!!
// Used alongside the NiceToolTips mod, will show
// recent topics in a table with tool tip previews.

// @SMF Mods : http://custom.simplemachines.org/mods/index.php?mod=2115
// @Tiny Portal : http://www.tinyportal.net/index.php?topic=31642

// This version : 13 April 2010 Update to work with SMF2RC3
// Note that this version is ONLY for SMF2.
// *********************************************************************

// Configuration, set the number of posts to show:
   
$num_recent = 8;
   
// Config end.


global $scripturl, $settings, $modSettings, $db_prefix, $user_info, $smcFunc, $txt;

// First get all the NiceToolTip javascript in place if it's needed.
// The javascript is not needed when we are in a board as the NiceToolTip module
// will already have loaded it.  We just need to add it if we are elsewhere...

// So add the code if we are not in a board
// OR When viewing a topic the board is also set,
// so we need to add the javascript then too...
   
if (!isset($_GET['board']) || isset($_GET['topic']))
   echo '
         <style type="text/css">
         .nice_tooltip_fgclass {
         background-color: ' . $modSettings['NiceTooltips_FGCOLOR'] . ';
         opacity: ' . $modSettings['NiceTooltips_OPACITY'] / 100 . ';
         }
         .nice_tooltip_bgclass {
         background-color: ' . $modSettings['NiceTooltips_BGCOLOR'] . ';
         opacity: ' . $modSettings['NiceTooltips_OPACITY'] / 100 . ';
         }
         </style>

         <script language="JavaScript" type="text/javascript" src="' . $settings['default_theme_url'] . (!empty($modSettings['NiceTooltips_scripturl']) ? '/' . $modSettings['NiceTooltips_scripturl'] : '') .   '/overlib_mini.js"></script>

         <script language="JavaScript" type="text/javascript" src="' . $settings['default_theme_url'] . (!empty($modSettings['NiceTooltips_scripturl']) ? '/' . $modSettings['NiceTooltips_scripturl'] : '') . '/overlib_adaptive_width.js"></script>
';


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

   
if ($exclude === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
   $exclude = array($modSettings['recycle_board']);
else
   $exclude = empty($exclude) ? array() : $exclude;   

// Icons...   
$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless', 'clip');
$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.
// Stripped down from SSI.php ssi_recentTopics() function.

$request = $smcFunc['db_query']('', '
   SELECT
      m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, b.id_board, b.name AS board_name, t.num_replies, t.num_views,
      IFNULL(mem.real_name, m.poster_name) AS poster_name, ' . ($user_info['is_guest'] ? '1 AS is_read, 0 AS new_from' : '
      IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) >= m.id_msg_MODIFIED AS is_read,
      IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from') . ',
      LEFT(m.body, '. (!empty($modSettings['NiceTooltips_lenght']) ? $modSettings['NiceTooltips_lenght'] : 384) .') AS body, m.smileys_enabled, 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 = '.$context['user']['id'].')
      LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = '.$context['user']['id'].')' : '') . '
   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) ? '' : '
      AND b.id_board NOT IN ({array_int:exclude})') . '
      AND {query_see_board}
      AND ms.id_msg = t.id_first_msg
   ORDER BY t.id_last_msg DESC
   LIMIT {int:num_recent}',
   array('exclude' => $exclude, 'num_recent' => $num_recent)
);
 
$posts = array();

while ($row = $smcFunc['db_fetch_assoc']($request))
{
   // Build the array.
   $posts[] = array(
      'board' => array(
         'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>'
      ),
      'topic' => $row['id_topic'],
      'poster' => array(
         'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'
      ),
      'subject' => $row['subject'],
      'preview' => $row['body'],
      'time' => timeformat($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">' . $row['subject'] . '</a>',
      'new' => !empty($row['is_read']),
      'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
      'viewsreplies' => $row['num_views'] . '/' . $row['num_replies'],
   );
}

$smcFunc['db_free_result']($request);

   
// Now for the output...

echo '
   <table border="0" width="100%" cellspacing="1" cellpadding="3" class="bordercolor">
      <tr class="titlebg">
         <td align="center" colspan="2">Subject</td>
         <td align="center">Board</td>
         <td align="center">Views/Replies</td>
         <td align="center">Member</td>
         <td align="center">Date & Time</td>
      </tr>';

$bg = false;

foreach ($posts as $topic)
{
   // Generate the popup.
   $popup = NiceTooltip($topic['preview'], $topic['subject']);
   
   echo '
      <tr class="windowbg' , $bg ? '2' : '' , '">';
     
   $bg = !$bg;
   
   echo '
         <td valign="middle">
            ' , $topic['icon'] , '
         </td>
         <td>
            <a href="' , $topic['href'] , '"' , $popup , '>' , $topic['subject'] , '</a>';

    // 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="', $txt['new'], '" border="0" align="right", valign="absmiddle" /></a>';
   
   echo '
         </td>
         <td valign="middle">' , $topic['board']['link'], '</td>';
   
   echo '
         <td valign="middle" align="center">' , $topic['viewsreplies'] , '</td>';
   
   echo '
         <td valign="middle" >', $topic['poster']['link'], '</td>
         <td 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="', $txt['last_post'], '" title="', $txt['last_post'], '" border="0" style="float: right;" /></a>';
   
   echo '
            <span class="smalltext">', $topic['time'], '</span>
         </td>
      </tr>';
}

echo '
   </table>';

Offline Dramber

  • Jr. Member
  • **
  • Posts: 8
    • New Dawn
Re: [Discussion] Recent topics table with hover over previews.
« Reply #151 on: June 14, 2011, 05:45:38 AM »
Thanks!
That's just what I wanted. Works like a charm.

Offline ZarPrime

  • Friends
  • *
  • Posts: 4653
Re: [Discussion] Recent topics table with hover over previews.
« Reply #152 on: June 14, 2011, 05:48:42 AM »
Perfect. O0

ZarPrime

Offline Freddy

  • Moderator
  • *
  • Posts: 1617
    • AiDreams
Re: [Discussion] Recent topics table with hover over previews.
« Reply #153 on: June 14, 2011, 05:57:08 AM »
Added this to the code page, thanks  O0

Offline MrCare

  • Jr. Member
  • **
  • Posts: 62
Re: [Discussion] Recent topics table with hover over previews.
« Reply #154 on: November 03, 2011, 05:39:05 AM »
how can we put another colum that we can put . Users can click that and share that topic in their facebook.

Offline Freddy

  • Moderator
  • *
  • Posts: 1617
    • AiDreams
Re: [Discussion] Recent topics table with hover over previews.
« Reply #155 on: November 04, 2011, 09:15:05 AM »
Google would have got you there :

http://developers.facebook.com/docs/share/

Offline jarska

  • Jr. Member
  • **
  • Posts: 22
Re: [Discussion] Recent topics table with hover over previews.
« Reply #156 on: January 20, 2012, 02:25:48 AM »
Nice, thank you!
What to do if I want hovering and show only members avatar, like TP recent topics? ::)

Offline thechamp

  • Jr. Member
  • **
  • Posts: 8
Re: [Discussion] Recent topics table with hover over previews.
« Reply #157 on: January 29, 2012, 12:49:07 PM »
Here's the one I use, Brad has already converted it for me.  O0

Code: [Select]
// *********************************************************************
// A PHP block by Freddy888 and MrCare
// !!Modified to show icon, number of views and replies.!!
// Used alongside the NiceToolTips mod, will show
// recent topics in a table with tool tip previews.

// @SMF Mods : http://custom.simplemachines.org/mods/index.php?mod=2115
// @Tiny Portal : http://www.tinyportal.net/index.php?topic=31642

// This version : 13 April 2010 Update to work with SMF2RC3
// Note that this version is ONLY for SMF2.
// *********************************************************************

// Configuration, set the number of posts to show:
   
$num_recent = 8;
   
// Config end.


global $scripturl, $settings, $modSettings, $db_prefix, $user_info, $smcFunc, $txt;

// First get all the NiceToolTip javascript in place if it's needed.
// The javascript is not needed when we are in a board as the NiceToolTip module
// will already have loaded it.  We just need to add it if we are elsewhere...

// So add the code if we are not in a board
// OR When viewing a topic the board is also set,
// so we need to add the javascript then too...
   
if (!isset($_GET['board']) || isset($_GET['topic']))
   echo '
         <style type="text/css">
         .nice_tooltip_fgclass {
         background-color: ' . $modSettings['NiceTooltips_FGCOLOR'] . ';
         opacity: ' . $modSettings['NiceTooltips_OPACITY'] / 100 . ';
         }
         .nice_tooltip_bgclass {
         background-color: ' . $modSettings['NiceTooltips_BGCOLOR'] . ';
         opacity: ' . $modSettings['NiceTooltips_OPACITY'] / 100 . ';
         }
         </style>

         <script language="JavaScript" type="text/javascript" src="' . $settings['default_theme_url'] . (!empty($modSettings['NiceTooltips_scripturl']) ? '/' . $modSettings['NiceTooltips_scripturl'] : '') .   '/overlib_mini.js"></script>

         <script language="JavaScript" type="text/javascript" src="' . $settings['default_theme_url'] . (!empty($modSettings['NiceTooltips_scripturl']) ? '/' . $modSettings['NiceTooltips_scripturl'] : '') . '/overlib_adaptive_width.js"></script>
';


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

   
if ($exclude === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
   $exclude = array($modSettings['recycle_board']);
else
   $exclude = empty($exclude) ? array() : $exclude;   

// Icons...   
$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless', 'clip');
$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.
// Stripped down from SSI.php ssi_recentTopics() function.

$request = $smcFunc['db_query']('', '
   SELECT
      m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, b.id_board, b.name AS board_name, t.num_replies, t.num_views,
      IFNULL(mem.real_name, m.poster_name) AS poster_name, ' . ($user_info['is_guest'] ? '1 AS is_read, 0 AS new_from' : '
      IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) >= m.id_msg_MODIFIED AS is_read,
      IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from') . ',
      LEFT(m.body, '. (!empty($modSettings['NiceTooltips_lenght']) ? $modSettings['NiceTooltips_lenght'] : 384) .') AS body, m.smileys_enabled, 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 = '.$context['user']['id'].')
      LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = '.$context['user']['id'].')' : '') . '
   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) ? '' : '
      AND b.id_board NOT IN ({array_int:exclude})') . '
      AND {query_see_board}
      AND ms.id_msg = t.id_first_msg
   ORDER BY t.id_last_msg DESC
   LIMIT {int:num_recent}',
   array('exclude' => $exclude, 'num_recent' => $num_recent)
);
 
$posts = array();

while ($row = $smcFunc['db_fetch_assoc']($request))
{
   // Build the array.
   $posts[] = array(
      'board' => array(
         'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>'
      ),
      'topic' => $row['id_topic'],
      'poster' => array(
         'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'
      ),
      'subject' => $row['subject'],
      'preview' => $row['body'],
      'time' => timeformat($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">' . $row['subject'] . '</a>',
      'new' => !empty($row['is_read']),
      'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
      'viewsreplies' => $row['num_views'] . '/' . $row['num_replies'],
   );
}

$smcFunc['db_free_result']($request);

   
// Now for the output...

echo '
   <table border="0" width="100%" cellspacing="1" cellpadding="3" class="bordercolor">
      <tr class="titlebg">
         <td align="center" colspan="2">Subject</td>
         <td align="center">Board</td>
         <td align="center">Views/Replies</td>
         <td align="center">Member</td>
         <td align="center">Date & Time</td>
      </tr>';

$bg = false;

foreach ($posts as $topic)
{
   // Generate the popup.
   $popup = NiceTooltip($topic['preview'], $topic['subject']);
   
   echo '
      <tr class="windowbg' , $bg ? '2' : '' , '">';
     
   $bg = !$bg;
   
   echo '
         <td valign="middle">
            ' , $topic['icon'] , '
         </td>
         <td>
            <a href="' , $topic['href'] , '"' , $popup , '>' , $topic['subject'] , '</a>';

    // 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="', $txt['new'], '" border="0" align="right", valign="absmiddle" /></a>';
   
   echo '
         </td>
         <td valign="middle">' , $topic['board']['link'], '</td>';
   
   echo '
         <td valign="middle" align="center">' , $topic['viewsreplies'] , '</td>';
   
   echo '
         <td valign="middle" >', $topic['poster']['link'], '</td>
         <td 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="', $txt['last_post'], '" title="', $txt['last_post'], '" border="0" style="float: right;" /></a>';
   
   echo '
            <span class="smalltext">', $topic['time'], '</span>
         </td>
      </tr>';
}

echo '
   </table>';

Hi, I like this one and im using it, any chance you can include the column, topic started by?

Thanks

Offline MinatO

  • Jr. Member
  • **
  • Posts: 24
Re: [Discussion] Recent topics table with hover over previews.
« Reply #158 on: February 07, 2012, 12:30:16 PM »
Here's the one I use, Brad has already converted it for me.  O0

Code: [Select]
// *********************************************************************
// A PHP block by Freddy888 and MrCare
// !!Modified to show icon, number of views and replies.!!
// Used alongside the NiceToolTips mod, will show
// recent topics in a table with tool tip previews.

// @SMF Mods : http://custom.simplemachines.org/mods/index.php?mod=2115
// @Tiny Portal : http://www.tinyportal.net/index.php?topic=31642

// This version : 13 April 2010 Update to work with SMF2RC3
// Note that this version is ONLY for SMF2.
// *********************************************************************

// Configuration, set the number of posts to show:
   
$num_recent = 8;
   
// Config end.


global $scripturl, $settings, $modSettings, $db_prefix, $user_info, $smcFunc, $txt;

// First get all the NiceToolTip javascript in place if it's needed.
// The javascript is not needed when we are in a board as the NiceToolTip module
// will already have loaded it.  We just need to add it if we are elsewhere...

// So add the code if we are not in a board
// OR When viewing a topic the board is also set,
// so we need to add the javascript then too...
   
if (!isset($_GET['board']) || isset($_GET['topic']))
   echo '
         <style type="text/css">
         .nice_tooltip_fgclass {
         background-color: ' . $modSettings['NiceTooltips_FGCOLOR'] . ';
         opacity: ' . $modSettings['NiceTooltips_OPACITY'] / 100 . ';
         }
         .nice_tooltip_bgclass {
         background-color: ' . $modSettings['NiceTooltips_BGCOLOR'] . ';
         opacity: ' . $modSettings['NiceTooltips_OPACITY'] / 100 . ';
         }
         </style>

         <script language="JavaScript" type="text/javascript" src="' . $settings['default_theme_url'] . (!empty($modSettings['NiceTooltips_scripturl']) ? '/' . $modSettings['NiceTooltips_scripturl'] : '') .   '/overlib_mini.js"></script>

         <script language="JavaScript" type="text/javascript" src="' . $settings['default_theme_url'] . (!empty($modSettings['NiceTooltips_scripturl']) ? '/' . $modSettings['NiceTooltips_scripturl'] : '') . '/overlib_adaptive_width.js"></script>
';


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

   
if ($exclude === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
   $exclude = array($modSettings['recycle_board']);
else
   $exclude = empty($exclude) ? array() : $exclude;   

// Icons...   
$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless', 'clip');
$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.
// Stripped down from SSI.php ssi_recentTopics() function.

$request = $smcFunc['db_query']('', '
   SELECT
      m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, b.id_board, b.name AS board_name, t.num_replies, t.num_views,
      IFNULL(mem.real_name, m.poster_name) AS poster_name, ' . ($user_info['is_guest'] ? '1 AS is_read, 0 AS new_from' : '
      IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) >= m.id_msg_MODIFIED AS is_read,
      IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from') . ',
      LEFT(m.body, '. (!empty($modSettings['NiceTooltips_lenght']) ? $modSettings['NiceTooltips_lenght'] : 384) .') AS body, m.smileys_enabled, 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 = '.$context['user']['id'].')
      LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = '.$context['user']['id'].')' : '') . '
   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) ? '' : '
      AND b.id_board NOT IN ({array_int:exclude})') . '
      AND {query_see_board}
      AND ms.id_msg = t.id_first_msg
   ORDER BY t.id_last_msg DESC
   LIMIT {int:num_recent}',
   array('exclude' => $exclude, 'num_recent' => $num_recent)
);
 
$posts = array();

while ($row = $smcFunc['db_fetch_assoc']($request))
{
   // Build the array.
   $posts[] = array(
      'board' => array(
         'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>'
      ),
      'topic' => $row['id_topic'],
      'poster' => array(
         'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'
      ),
      'subject' => $row['subject'],
      'preview' => $row['body'],
      'time' => timeformat($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">' . $row['subject'] . '</a>',
      'new' => !empty($row['is_read']),
      'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
      'viewsreplies' => $row['num_views'] . '/' . $row['num_replies'],
   );
}

$smcFunc['db_free_result']($request);

   
// Now for the output...

echo '
   <table border="0" width="100%" cellspacing="1" cellpadding="3" class="bordercolor">
      <tr class="titlebg">
         <td align="center" colspan="2">Subject</td>
         <td align="center">Board</td>
         <td align="center">Views/Replies</td>
         <td align="center">Member</td>
         <td align="center">Date & Time</td>
      </tr>';

$bg = false;

foreach ($posts as $topic)
{
   // Generate the popup.
   $popup = NiceTooltip($topic['preview'], $topic['subject']);
   
   echo '
      <tr class="windowbg' , $bg ? '2' : '' , '">';
     
   $bg = !$bg;
   
   echo '
         <td valign="middle">
            ' , $topic['icon'] , '
         </td>
         <td>
            <a href="' , $topic['href'] , '"' , $popup , '>' , $topic['subject'] , '</a>';

    // 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="', $txt['new'], '" border="0" align="right", valign="absmiddle" /></a>';
   
   echo '
         </td>
         <td valign="middle">' , $topic['board']['link'], '</td>';
   
   echo '
         <td valign="middle" align="center">' , $topic['viewsreplies'] , '</td>';
   
   echo '
         <td valign="middle" >', $topic['poster']['link'], '</td>
         <td 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="', $txt['last_post'], '" title="', $txt['last_post'], '" border="0" style="float: right;" /></a>';
   
   echo '
            <span class="smalltext">', $topic['time'], '</span>
         </td>
      </tr>';
}

echo '
   </table>';
Can anyone help me with this?

I tried this code but I get an error:

"Fatal error: Call to undefined function NiceTooltip() in /home/cyberspo/public_html/Sources/Load.php(2203) : eval()'d code(114) : eval()'d code on line 137"

I only installed SMF and TP only 3-4 days ago so it can't be a version problem right?

EDIT: nvm, Ichbin has his own topic for this aswell apparently and his script worked!

Offline lurkalot

  • Administrator
  • *
  • Posts: 7415
    • Camera Craniums
Re: [Discussion] Recent topics table with hover over previews.
« Reply #159 on: February 07, 2012, 02:35:25 PM »

I tried this code but I get an error:

"Fatal error: Call to undefined function NiceTooltip() in /home/cyberspo/public_html/Sources/Load.php(2203) : eval()'d code(114) : eval()'d code on line 137"

I only installed SMF and TP only 3-4 days ago so it can't be a version problem right?

EDIT: nvm, Ichbin has his own topic for this aswell apparently and his script worked!

Did you install and activate the NiceTooltips mod?