TinyPortal

Development => Block Codes => Topic started by: alhaudhie on September 14, 2009, 04:58:20 PM

Title: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on September 14, 2009, 04:58:20 PM
Edit by freddy888 : I've turned this thread over to discussion, instead the latest code for this block can be found here, in a easy to find place : The Code... (http://www.tinyportal.net/index.php?topic=31642)

Feel free to talk more about what we can do with this code in this thread.

Original request....


Quote from: Mrcare on March 29, 2009, 07:28:33 AM
Quote from: JPDeni on March 29, 2009, 12:58:13 AM
Mrcare, adding a message preview on mouseover would require javascript, which I'm not familiar with. (I didn't want you to think I was just ignoring you.)

Yes... hope one day anybody can make it....

maybe like this

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fi477.photobucket.com%2Falbums%2Frr138%2Fsratuspratus%2F1.jpg%3Ft%3D1230145170&hash=cb56315c6c0b4be5900fbc4d95e578777ae01b51)
i have find simila of this in

http://custom.simplemachines.org/mods/index.php?mod=2115

but what must i do? anybody can help to show new preview like that mod in frontpage with this code
global $scripturl;
$what=ssi_recentTopics('10', NULL, 'array');

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


$bg=false;
foreach ($what as $topic)
{
   echo '<tr class="windowbg' , $bg ? '2' : '' , '">';
   $bg = !$bg;
    echo '<td 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', $txt[302], '" border="0" align="right", valign="absmiddle"/>[/url]';
   echo '</td>
      <td valign="middle" >', $topic['board']['link'], '</td>';
   echo '</td>
      <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[111], '" title="', $txt[111], '" border="0" style="float: right;" />[/url]';
    echo '<span class="smalltext">', $topic['time'], '</span></td></tr>';
  }

echo '</table>'
Title: [Block] Recent topics with hover over previews.
Post by: Freddy on September 14, 2009, 07:11:32 PM
There are errors in your code, but I will take a look at this.
Title: [Block] Recent topics with hover over previews.
Post by: Freddy on September 14, 2009, 08:26:36 PM
I went over your code and corrected it.  You need to install the mod you mentioned for this to work.  This should do the trick, assuming you have that mod installed you can use this in a PHP block or article :


global $scripturl, $settings, $modSettings;

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>';

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

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

$what=ssi_recentTopics('10', NULL, 'array');

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

$bg=false;

foreach ($what as $topic)
{
$popup = NiceTooltip($topic['preview'], $topic['subject']);
echo '<tr class="windowbg' , $bg ? '2' : '' , '">';
$bg = !$bg;
   echo '<td valign="middle"><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="New', $txt[302], '" border="0" align="right", valign="absmiddle" /></a>';

echo '</td>
     <td valign="middle" >', $topic['board']['link'], '</td>';

echo '</td>
     <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[111], '" title="', $txt[111], '" border="0" style="float: right;" /></a>';

echo '<span class="smalltext">', $topic['time'], '</span></td></tr>';
}

echo '</table>';


Because you are using SSI, there is a limit to what is shown in the message body.  With the default SSI settings it is limited to 128 characters.

You can change this by going to SSI.php and finding (around line 372)

if ($func['strlen']($row['body']) > 128)
$row['body'] = $func['substr']($row['body'], 0, 128) . '...';


Change both 128 to whatever you want...

Hope that get's you on track.  :)

Screenshot attached...I din't change my colours, that's why it doesn't match, but it works.
Title: [Block] Recent topics with hover over previews.
Post by: IchBin on September 14, 2009, 09:15:11 PM
Freddy, I think once the user has acknowledged it works for him you should split the topic and put your code into a different topic. This topic is 52 pages long... Any significant changes I think should be in a new topic. Hope thats cool.
Title: [Block] Recent topics with hover over previews.
Post by: NCSurfer on September 15, 2009, 12:59:29 AM
Freddy, Ichbin the code that you came up with along with the Nice Tooltips MOD worked great.

Thanks
Title: [Block] Recent topics with hover over previews.
Post by: Freddy on September 15, 2009, 10:32:34 AM
Ichbin, no problem with that, I'll just wait till Mrcare responds.

NCSurfer, Great, I am glad it worked and you're welcome :)
Title: [Block] Recent topics with hover over previews.
Post by: alhaudhie on September 15, 2009, 06:00:21 PM
finally i got it... thank you soo much.. nice helper...
Title: [Block] Recent topics with hover over previews.
Post by: Freddy on September 15, 2009, 06:09:06 PM
Glad you got it sorted  :)

If you want to change the number of posts shown then change this line to what you want :

$what=ssi_recentTopics('10', NULL, 'array');

So just change 10 to however many you need.
Title: Re: [Block] Recent topics with hover over previews.
Post by: NCSurfer on September 21, 2009, 11:23:06 PM
I do have one more question in regards to this statement Freddy...

QuoteYou can change this by going to SSI.php and finding (around line 372)

Code:

if ($func['strlen']($row['body']) > 128)
         $row['body'] = $func['substr']($row['body'], 0, 128) . '...';


Change both 128 to whatever you want...

I can't find the location of this file in the default theme or my theme. Could you please tell me where it is?

Thanks
Title: Re: [Block] Recent topics with hover over previews.
Post by: IchBin on September 22, 2009, 06:20:20 AM
SSI.php is in the top level of your forum. The root directory.
Title: Re: [Block] Recent topics with hover over previews.
Post by: NCSurfer on September 22, 2009, 03:24:40 PM
Thankyou for the help. Got it.
Title: Re: [Block] Recent topics with hover over previews.
Post by: jebong on October 13, 2009, 06:13:26 PM
tq...

nice job..

my question is.. how to put this preview in this code?

global $context, $settings, $scripturl, $txt, $db_prefix, $ID_MEMBER, $user_info, $modSettings, $user_profile;

//////////////////////////////////////////// ---------- Unconditional Exclude
//
$exclude_boards = array(); // KEEP (to preserve variable declaration)
// $exclude_boards = array(5); //  Exclude single board
//  $exclude_boards = array(55,69); //  Exclude multiple boards
$ex_board_clause = !empty($exclude_boards) ? ' AND b.ID_BOARD NOT IN (' . implode(', ', $exclude_boards) . ')' : '';
//
//

//////////////////////////////////////////// ---------- Use in TP PHP Article (no title or frame from theme)
// This will give most recent XX posted to topics -OR-
// most recent XX unreplied to topics -OR-
// topics posted to in last XX hours -OR-
// most recent XX topics on topic notify list
//
// Sorts by most recent reply (descending; most recent first) -OR-
//          creation order (descending; most recent first)
//
// All in the detailed topic format
//
//
// Default
// index.php?page=##
// most recent posted to topics - will list
// number equal to  $settings['number_recent_posts']
//
// index.php?page=##;count=50 or index.php?page=##;type=last;count=50
// 50 most recently posted to topics
//
// index.php?page=##;type=unreplied or index.php?page=##;type=unreplied;count=50
// Most recent unreplied to topics - will
// list number specified in 'count' or default to
// number equal to  $settings['number_recent_posts']
//
// index.php?page=##;type=hours or index.php?page=##;type=hours;count=12
// Topics posted to in last number of hours
// specified in 'count' or default to 24.
//
// index.php?page=##;type=notify or index.php?page=##;type=notify;count=50
// Topics in topic notifcation list up to number
// specified in 'count' or a maximum of 100 topics.
//
// *** Admins Only ***
// index.php?page=##;type=notify;user=XXX or index.php?page=##;type=notify;user=XXX;count=50
// Topics in topic notifcation list of specified user up to number
// specified in 'count' or a maximum of 100 topics.
//
// index.php?page=##;type=started or index.php?page=##;type=started;count=50
// Topics started by current user list up to number
// specified in 'count' or a maximum of 100 topics.
//
// *** Admins Only ***
// index.php?page=##;type=notify;user=XXX or index.php?page=##;type=started;user=XXX;count=50
// Topics started by specified user up to number
// specified in 'count' or a maximum of 100 topics.
//
// Add argument order=create to sort by topic creation sequence (most recent first)
// rather than by last reply sequence

$do_query = 1;

//////////////////////////////////////////// ---------- Poor Man's Global Announcements Block (center block - no Title/Frame)
// Delete documentation comments above and marked section below
//
// $announce_topics = array(254, 568, 675, 678); // Topic ID's to be 'Announced'
//
// $heading = '<center>Announcements<center>';
// $where_clause = 't.ID_TOPIC IN (' . implode(', ', $announce_topics) . ')';
// $limit_clause = '';
// $order_clause = 't.ID_LAST_MSG DESC';
////////////////////////////////////////////   

//////////////////////////////////////////// ---------- Last 5 Topics Started by User Block (center block - no Title/Frame)
// Delete documentation comments above and marked section below
//
// $heading = 'Most Recent Topics You Started';
// $where_clause = 'ms.ID_MEMBER = '.$ID_MEMBER;
// $limit_clause = 'LIMIT 5';
// $order_clause = 't.ID_FIRST_MSG DESC';
////////////////////////////////////////////   

//////////////////////////////////////////// ---------- Boardindex Most Recent Topics Arguments
//
// Comment out the Info Center's Most Recent Posts Code and Insert this
// to show Most Recent Topics in full detail style instead
//
// $list_count = $settings['number_recent_posts'];
// $heading = 'Most Recently Posted To Topics';
// $where_clause = 't.ID_LAST_MSG >= ' . ($modSettings['maxMsgID'] - 50 * min($list_count, 5));
// $limit_clause = 'LIMIT ' . $list_count;
// $order_clause = 't.ID_LAST_MSG DESC';
////////////////////////////////////////////   

////////////////////////////////////////////  ------ Remove down to next mark to use in block/boardindex ------
//
if (empty($settings['number_recent_posts']))
$number_recent_posts = 20;
else
$number_recent_posts = $settings['number_recent_posts'];

        if( isset($_GET['type']) )
$list_type = $_GET['type'];
else
$list_type = 'last';

        if( isset($_GET['count']) )
$list_count = $_GET['count'];
else
{
$list_count = $number_recent_posts;
if ($list_type == 'notify')
$list_count = 100;
elseif ($list_type == 'hours')
$list_count = 24;
}

if ($list_count <= 0)
{
$list_count = $number_recent_posts;
if ($list_type == 'hours')
$list_count = 24;
}

if ($list_count > 100)
$list_count = 100;

        if( isset($_GET['order']) )
$list_order = $_GET['order'];
else
$list_order = 'lastpost';

        if( $list_order == 'create' )
$order_clause = 't.ID_FIRST_MSG DESC';
else
$order_clause = 't.ID_LAST_MSG DESC';

if ($list_type == 'hours')
{
$list_from = strtotime($list_count.' hours ago');
$where_clause = 'ml.posterTime >= ' . $list_from;
$limit_clause = ' ';
$heading = 'Topics Posted To In Last '. $list_count . ' Hours';
}
elseif ($list_type == 'unreplied')
{
$where_clause = 't.numReplies = 0';
if ($list_count == 0)
{
$limit_clause = ' ';
$heading = 'Unreplied To Topics';
}
else
{
$limit_clause = 'LIMIT ' . $list_count;
$heading = $list_count . ' Most Recent Unreplied To Topics';
}
}
elseif ($list_type == 'notify')
{
if (isset($_GET['user']) && $user_info['is_admin'])
{
$watched_topics = array();
$request = db_query("SELECT ID_TOPIC FROM {$db_prefix}log_notify WHERE ID_MEMBER = {$_GET['user']} AND ID_BOARD = 0", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
$watched_topics[] = $row['ID_TOPIC'];
mysql_free_result($request);
$heading = $list_count . ' Most Recent Topics Being Watched by User # '.$_GET['user'];
$where_clause = 't.ID_TOPIC IN (' . implode(', ', $watched_topics) . ')';
$limit_clause = 'LIMIT ' . $list_count;
if (empty($watched_topics))
$do_query = 0;
}
else
{
$watched_topics = array();
$request = db_query("SELECT ID_TOPIC FROM {$db_prefix}log_notify WHERE ID_MEMBER = {$ID_MEMBER} AND ID_BOARD = 0", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
$watched_topics[] = $row['ID_TOPIC'];
mysql_free_result($request);
$heading = $list_count . ' Most Recent Topics Being Watched';
$where_clause = 't.ID_TOPIC IN (' . implode(', ', $watched_topics) . ')';
$limit_clause = 'LIMIT ' . $list_count;
if (empty($watched_topics))
$do_query = 0;
}
}
elseif ($list_type == 'started')
{
if (isset($_GET['user']) && $user_info['is_admin'])
{
$where_clause = 'ms.ID_MEMBER = '.$_GET['user'];
$limit_clause = 'LIMIT ' . $list_count;
        if( $list_order == 'create' )
{
$order_clause = 't.ID_FIRST_MSG DESC';
$heading = 'Most Recent Topics Started by User '.$_GET['user'];
}
else
{
$order_clause = 't.ID_LAST_MSG DESC';
$heading = 'Most Recently Posted To Topics Started by User '.$_GET['user'];
}
}
else
{
$where_clause = 'ms.ID_MEMBER = '.$ID_MEMBER;
$limit_clause = 'LIMIT ' . $list_count;
        if( $list_order == 'create' )
{
$order_clause = 't.ID_FIRST_MSG DESC';
$heading = 'Most Recent Topics You Started';
}
else
{
$order_clause = 't.ID_LAST_MSG DESC';
$heading = 'Most Recently Posted To Topics You Started';
}
}
}
else
{
$where_clause = 't.ID_LAST_MSG >= ' . ($modSettings['maxMsgID'] - 90 * min($list_count, 5));
$limit_clause = 'LIMIT ' . $list_count;
$heading = $list_count . ' Most Recently Posted To Topics';
}
//
////////////////////////////////////////////  ------ Remove up to first mark to use in block/boardindex ------

$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';

$groupcolors = array();
$request = db_query("SELECT ID_GROUP, onlineColor FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
$groupcolors[$row['ID_GROUP']] = $row['onlineColor'];
mysql_free_result($request);

$topics = array();

if ($do_query == 1)
{
$request = db_query("
SELECT
ms.subject AS firstSubject, ms.posterTime AS firstPosterTime, ms.ID_TOPIC, t.ID_BOARD, b.name AS bname,
t.numReplies, t.numViews, ms.ID_MEMBER AS ID_FIRST_MEMBER, ml.ID_MEMBER AS ID_LAST_MEMBER,
ml.posterTime AS lastPosterTime, IFNULL(mems.realName, ms.posterName) AS firstPosterName,
IFNULL(meml.realName, ml.posterName) AS lastPosterName,
mems.ID_GROUP as mems_group, meml.ID_GROUP as meml_group,
ml.subject AS lastSubject, b.memberGroups,
ml.icon AS lastIcon, ms.icon AS firstIcon, t.ID_POLL, t.isSticky, t.locked, ml.modifiedTime AS lastModifiedTime,
LEFT(ml.body, 384) AS lastBody, LEFT(ms.body, 384) AS firstBody,
ml.smileysEnabled AS lastSmileys, ms.smileysEnabled AS firstSmileys, t.ID_FIRST_MSG, t.ID_LAST_MSG,"
. ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) >= ml.ID_MSG_MODIFIED AS isRead,
IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . "
FROM ({$db_prefix}messages AS ms, {$db_prefix}messages AS ml, {$db_prefix}topics AS t, {$db_prefix}boards AS b)
LEFT JOIN {$db_prefix}members AS mems ON (mems.ID_MEMBER = ms.ID_MEMBER)
LEFT JOIN {$db_prefix}members AS meml ON (meml.ID_MEMBER = ml.ID_MEMBER)
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 = t.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)
WHERE " . $where_clause . $ex_board_clause . "
AND t.ID_TOPIC = ms.ID_TOPIC
AND b.ID_BOARD = t.ID_BOARD" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? " AND b.ID_BOARD != $modSettings[recycle_board]" : '') . "
AND ms.ID_MSG = t.ID_FIRST_MSG
AND ml.ID_MSG = t.ID_LAST_MSG
AND " . $user_info['query_see_board'] . "
ORDER BY " . $order_clause . " " . $limit_clause, __FILE__, __LINE__);


$topic_ids = array();
while ($row = mysql_fetch_assoc($request))
{
if ($row['ID_POLL'] > 0 && $modSettings['pollMode'] == '0')
continue;

$topic_ids[] = $row['ID_TOPIC'];

// Clip the strings first because censoring is slow :/. (for some reason?)
$row['firstBody'] = strip_tags(strtr(parse_bbc($row['firstBody'], $row['firstSmileys'], $row['ID_FIRST_MSG']), array('<br />' => '
')));
if (strlen($row['firstBody']) > 128)
$row['firstBody'] = substr($row['firstBody'], 0, 128) . '...';
$row['lastBody'] = strip_tags(strtr(parse_bbc($row['lastBody'], $row['lastSmileys'], $row['ID_LAST_MSG']), array('<br />' => '
')));
if (strlen($row['lastBody']) > 128)
$row['lastBody'] = substr($row['lastBody'], 0, 128) . '...';

$row['lastSubject'] = $row['firstSubject'];
$row['lastBody'] = $row['firstBody'];

// Decide how many pages the topic should have.
$topic_length = $row['numReplies'] + 1;
if ($topic_length > $modSettings['defaultMaxMessages'])
{
$tmppages = array();
$tmpa = 1;
for ($tmpb = 0; $tmpb < $topic_length; $tmpb += $modSettings['defaultMaxMessages'])
{
$tmppages[] = '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.' . $tmpb . ';topicseen">' . $tmpa . '</a>';
$tmpa++;
}
// Show links to all the pages?
if (count($tmppages) <= 5)
$pages = 'Ã,« ' . implode(' ', $tmppages);
// Or skip a few?
else
$pages = 'Ã,« ' . $tmppages[0] . ' ' . $tmppages[1] . ' ... ' . $tmppages[count($tmppages) - 2] . ' ' . $tmppages[count($tmppages) - 1];

if (!empty($modSettings['enableAllMessages']) && $topic_length < $modSettings['enableAllMessages'])
$pages .= '  <a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0;all">' . $txt[190] . '</a>';
$pages .= ' Ã,»';
}
else
$pages = '';

// We need to check the topic icons exist... you can never be too sure!
if (empty($modSettings['messageIconChecks_disable']))
{
// First icon first... as you'd expect.
if (!isset($icon_sources[$row['firstIcon']]))
$icon_sources[$row['firstIcon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['firstIcon'] . '.gif') ? 'images_url' : 'default_images_url';
// Last icon... last... duh.
if (!isset($icon_sources[$row['lastIcon']]))
$icon_sources[$row['lastIcon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['lastIcon'] . '.gif') ? 'images_url' : 'default_images_url';
}

$color_start = !empty($groupcolors[$row['mems_group']]) ? $groupcolors[$row['mems_group']] : '';
$color_last = !empty($groupcolors[$row['meml_group']]) ? $groupcolors[$row['meml_group']] : '';

// And build the array.
$topics[$row['ID_TOPIC']] = array(
'id' => $row['ID_TOPIC'],
'first_post' => array(
'id' => $row['ID_FIRST_MSG'],
'member' => array(
'name' => $row['firstPosterName'],
'id' => $row['ID_FIRST_MEMBER'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_FIRST_MEMBER'],
'link' => !empty($row['ID_FIRST_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_FIRST_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['firstPosterName'] . '">' . '<font color="' . $color_start . '">' . $row['firstPosterName'] . '</font>' . '</a>' : $row['firstPosterName']
),
'time' => timeformat($row['firstPosterTime']),
'timestamp' => forum_time(true, $row['firstPosterTime']),
'subject' => $row['firstSubject'],
'preview' => $row['firstBody'],
'icon' => $row['firstIcon'],
'icon_url' => $settings[$icon_sources[$row['firstIcon']]] . '/post/' . $row['firstIcon'] . '.gif',
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0;topicseen',
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0;topicseen">' . $row['firstSubject'] . '</a>'
),
'last_post' => array(
'id' => $row['ID_LAST_MSG'],
'member' => array(
'name' => $row['lastPosterName'],
'id' => $row['ID_LAST_MEMBER'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_LAST_MEMBER'],
'link' => !empty($row['ID_LAST_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_LAST_MEMBER'] . '">' . '<font color="' . $color_last . '">' . $row['lastPosterName'] . '</font>' . '</a>' : $row['lastPosterName']
),
'time' => timeformat($row['lastPosterTime']),
'timestamp' => forum_time(true, $row['lastPosterTime']),
'subject' => $row['lastSubject'],
'preview' => $row['lastBody'],
'icon' => $row['lastIcon'],
'icon_url' => $settings[$icon_sources[$row['lastIcon']]] . '/post/' . $row['lastIcon'] . '.gif',
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . ($row['numReplies'] == 0 ? '.0' : '.msg' . $row['ID_LAST_MSG']) . ';topicseen#msg' . $row['ID_LAST_MSG'],
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . ($row['numReplies'] == 0 ? '.0' : '.msg' . $row['ID_LAST_MSG']) . ';topicseen#msg' . $row['ID_LAST_MSG'] . '">' . $row['lastSubject'] . '</a>'
),
'new' => $row['isRead'],
'new_from' => $row['new_from'],
'new_href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['new_from'] . ';topicseen#new',
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . ($row['numReplies'] == 0 ? '.0' : '.msg' . $row['new_from']) . ';topicseen' . ($row['numReplies'] == 0 ? '' : 'new'),
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . ($row['numReplies'] == 0 ? '.0' : '.msg' . $row['new_from']) . ';topicseen#msg' . $row['new_from'] . '">' . $row['firstSubject'] . '</a>',
'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,
'icon' => $row['firstIcon'],
'icon_url' => $settings[$icon_sources[$row['firstIcon']]] . '/post/' . $row['firstIcon'] . '.gif',
'subject' => $row['firstSubject'],
'pages' => $pages,
'replies' => $row['numReplies'],
'views' => $row['numViews'],
'board' => array(
'id' => $row['ID_BOARD'],
'name' => $row['bname'],
'href' => $scripturl . '?board=' . $row['ID_BOARD'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['ID_BOARD'] . '.0">' . $row['bname'] . '</a>'
)
);

determineTopicClass($topics[$row['ID_TOPIC']]);
}
mysql_free_result($request);

if (!empty($modSettings['enableParticipation']) && !empty($topic_ids))
{
$result = db_query("
SELECT ID_TOPIC
FROM {$db_prefix}messages
WHERE ID_TOPIC IN (" . implode(', ', $topic_ids) . ")
AND ID_MEMBER = $ID_MEMBER", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result))
{
if (empty($topics[$row['ID_TOPIC']]['is_posted_in']))
{
$topics[$row['ID_TOPIC']]['is_posted_in'] = true;
$topics[$row['ID_TOPIC']]['class'] = 'my_' . $topics[$row['ID_TOPIC']]['class'];
}
}
mysql_free_result($result);
}

}

if (!empty($topics))
    {
    echo '
        <div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'style="width: 100%;margin:0px;"' : 'style="margin:0px;"', '>
            <table border="0" width="100%" cellspacing="1" cellpadding="1" class="bordercolor">
                <tr>';

    echo '
                    <td class="titlebg" colspan="7">', $heading, '</td>';
    echo '
                </tr>';

    echo '
<tr class="titlebg">
<td width="10%" colspan="2"> </td>
<td>', $txt[70], '
</td><td width="14%">', $txt[109], '
</td><td width="4%" align="center">', $txt[110], '
</td><td width="4%" align="center">', $txt[301], '
</td><td width="24%">', $txt[111], '
</td>
</tr>';

foreach ($topics as $topic)
{
// 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)
{
echo '<a href="', $topic['new_href'], '"> <img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" /></a>';
}
echo '
<span class="smalltext">', $topic['pages'], '<br>', $txt['smf88'], ' ', $topic['board']['link'], '</span></td>
<td class="windowbg2" valign="middle" width="14%">
', $topic['first_post']['member']['link'], '</td>
<td class="windowbg" valign="middle" width="4%" align="center">
', $topic['replies'], '</td>
<td class="windowbg" valign="middle" width="4%" align="center">
', $topic['views'], '</td>
<td class="windowbg2" valign="middle" width="22%">
<a href="', $topic['last_post']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" title="', $txt[111], '" style="float: right;" /></a>
<span class="smalltext">
', $topic['last_post']['time'], '<br />
', $txt[525], ' ', $topic['last_post']['member']['link'], '
</span>
</td>
</tr>';
}

    echo '</table></div>';

    }
else
    echo '<b><u>'.$heading.'<br><br>No Topics Match Search Criteria</u></b>';


taking from : http://www.tinyportal.net/index.php/topic,596.msg247350.html#msg247350
Title: Re: [Block] Recent topics with hover over previews.
Post by: ZarPrime on October 15, 2009, 02:28:33 AM
jebong,

The preview code that freddy wrote is not designed to be used in the code you posted.  If you want a preview option for this code you should open a new request (topic) to add the preview to this code that you posted.  Please reference the topic where the code you posted originally came from in your new topic.  Once your new request is up, perhaps someone will take on the project.

ZarPrime
Title: Re: [Block] Recent topics with hover over previews.
Post by: alhaudhie on October 25, 2009, 12:35:17 AM
anybody can help fot this?
Title: Re: [Block] Recent topics with hover over previews.
Post by: IchBin on October 25, 2009, 04:35:29 AM
SMF does not parse bbc in the the recentTopics function. If you want to do that, you will need to add the parseBBC() arouind the $row['body'] section in the SSI.php file.
Title: Re: [Block] Recent topics with hover over previews.
Post by: alhaudhie on October 25, 2009, 05:40:41 AM
Quote from: IchBinâ„¢ on October 25, 2009, 04:35:29 AM
SMF does not parse bbc in the the recentTopics function. If you want to do that, you will need to add the parseBBC() arouind the $row['body'] section in the SSI.php file.
glad to here this..
hope can give the clue to put it.. tq
Title: Re: [Block] Recent topics with hover over previews.
Post by: coolmac112 on November 29, 2009, 03:49:58 PM
Hi guys,

I'm very thankful for this code. I do want to do something a bit different with it.

I want the block to display the name of the topic, then below it, some text about it...[which is appearing when the mouse is over link]

They can be separated by
...that doesn't really matter, i'll find my way.

Cheers, i hope its possible
Title: Re: [Block] Recent topics with hover over previews.
Post by: Freddy on November 29, 2009, 04:10:09 PM
Hmmm, that's what it does already...so all you want to do is put the line in...unless I misunderstand you.

You would need to change the code in that mod if you want the popup to display something different, so I suggest you ask the person that made the mod over on SMF.
Title: Re: [Block] Recent topics with hover over previews.
Post by: alhaudhie on December 18, 2009, 01:47:42 PM
Quote from: Mrcare on October 25, 2009, 05:40:41 AM
Quote from: IchBinâ„¢ on October 25, 2009, 04:35:29 AM
SMF does not parse bbc in the the recentTopics function. If you want to do that, you will need to add the parseBBC() arouind the $row['body'] section in the SSI.php file.
glad to here this..
hope can give the clue to put it.. tq

hope anybody can help... tq
Title: Re: [Block] Recent topics with hover over previews.
Post by: IchBin on December 18, 2009, 02:52:40 PM
Quote from: Mrcare on December 18, 2009, 01:47:42 PM
Quote from: Mrcare on October 25, 2009, 05:40:41 AM
Quote from: IchBinâ„¢ on October 25, 2009, 04:35:29 AM
SMF does not parse bbc in the the recentTopics function. If you want to do that, you will need to add the parseBBC() arouind the $row['body'] section in the SSI.php file.
glad to here this..
hope can give the clue to put it.. tq

hope anybody can help... tq

I take that back, it does call the parse_bbc() function already. So what seems to be your issue?
Title: Re: [Block] Recent topics with hover over previews.
Post by: alhaudhie on December 18, 2009, 04:40:59 PM
This code

global $scripturl, $settings, $modSettings;

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>';

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

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

$what=ssi_recentTopics('10', NULL, 'array');

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

$bg=false;

foreach ($what as $topic)
{
   $popup = NiceTooltip($topic['preview'], $topic['subject']);
   echo '<tr class="windowbg' , $bg ? '2' : '' , '">';
   $bg = !$bg;
    echo '<td valign="middle"><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="New', $txt[302], '" border="0" align="right", valign="absmiddle" /></a>';
   
   echo '</td>
      <td valign="middle" >', $topic['board']['link'], '</td>';
   
   echo '</td>
      <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[111], '" title="', $txt[111], '" border="0" style="float: right;" /></a>';
   
   echo '<span class="smalltext">', $topic['time'], '</span></td></tr>';
}

echo '</table>';


dosn't show / can't show bbc code in full funtion.
Title: Re: [Block] Recent topics with hover over previews.
Post by: Freddy on December 18, 2009, 04:48:14 PM
Try changing this line :

$popup = NiceTooltip($topic['preview'], $topic['subject']);

To this :

$popup = NiceTooltip(parse_bbc($topic['preview']), $topic['subject']);
Title: Re: [Block] Recent topics with hover over previews.
Post by: alhaudhie on December 19, 2009, 04:34:36 AM
same result after test. tq
Title: Re: [Block] Recent topics with hover over previews.
Post by: alhaudhie on December 19, 2009, 03:46:23 PM
Ok... hope we can go to another things about the code above.

I have succesfully add

                       ', $topic['icon'], '

but how can i change the topic icon to choose the first icon/start topic  icon from that topic? Not the latest one.. tq

Is there we can change   ', $topic['first_icon'], ' can it?
Title: Re: [Block] Recent topics with hover over previews.
Post by: Freddy on December 19, 2009, 04:57:25 PM
I don't think that is possible because ssi_recentTopics only returns the icon that is for each individual post.

You would probably need to rewrite that function, but I am busy this weekend, so can't do any long projects.

Maybe someone else has an idea ?
Title: Re: [Block] Recent topics with hover over previews.
Post by: alhaudhie on December 19, 2009, 11:32:42 PM
no problem at all..

i will wait for u or someone else to rerwrite it. tq
Title: Re: [Block] Recent topics with hover over previews.
Post by: prometheus fire on December 31, 2009, 04:03:50 PM
The below is the standard Recent Topics code that came with TP. This is from TPBlocks.template.php. This one is slightly modified to meet my needs (minimized display and scrolling).

How/where do I insert the NiceToolTips code into it to take advantage of the feature? I've looked through the code presented in this thread, and tried a few things but I end up breaking things. I just don't know enough about php to do this on my own.

// 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();

   $ex_aeva = empty($modSettings['aeva_enable']) ? 0 : 1;
   $modSettings['aeva_enable'] = 0;
   $what = ssi_recentTopics($context['TPortal']['recentboxnum'], $bb, 'array');
   $modSettings['aeva_enable'] = $ex_aeva;

   // Output the topics
echo '<marquee  behavior="scroll" direction="up" height="150px" scrolldelay="1" scrollamount=" 1" onmouseover="this.stop()" onmouseout="this.start()">';
   echo '
   <ul class="tp_recentblock" style="' , $context['TPortal']['recentboxscroll']==1 ? 'overflow: auto; height: 20ex;' : '' , '">';
   foreach($what as $w){
      echo '
      <li style="overflow: auto;"><a href="'.$w['href'].'">'.$w['subject'].'</a></li>';
   }
   echo '
   </ul>';

}

Title: Re: [Block] Recent topics with hover over previews.
Post by: Freddy on December 31, 2009, 05:00:57 PM
Working on this....
Title: Re: [Block] Recent topics with hover over previews.
Post by: Freddy on December 31, 2009, 05:49:21 PM
Yes verily...when and where to add the code is important as the Tool Tips mod will add the javascript itself when the user is within a board...therefore your code needs to spot this and drop the code in everywhere else that it will be needed.

The code below I wrote to go into a PHP block, because it was easier for me to work with - you can try it out within that function you posted in place of the code you gave and it should work.

I have done a bit of testing, it seems error free.  Let me know how you get on.



global $context, $settings, $options, $txt , $modSettings;

// 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 set/registered but the ToolTip code doesn't,
// load the javascript in that case, 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>
';


// Now on to the 'recents' code...

    // 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();

   $ex_aeva = empty($modSettings['aeva_enable']) ? 0 : 1;
   $modSettings['aeva_enable'] = 0;
   $what = ssi_recentTopics($context['TPortal']['recentboxnum'], $bb, 'array');
   $modSettings['aeva_enable'] = $ex_aeva;

   // Output the topics

echo '
<marquee  behavior="scroll" direction="up" height="150px" scrolldelay="1" scrollamount=" 1" onmouseover="this.stop()" onmouseout="this.start()">';

echo '
<ul class="tp_recentblock" style="' , $context['TPortal']['recentboxscroll']==1 ? 'overflow: auto; height: 20ex;' : '' , '">';

foreach($what as $w)
{
// Generate the pop up...
$popup = NiceTooltip($w['preview'], $w['subject']);

echo '
<li style="overflow: auto;"><a href="' , $w['href'] , '"' , $popup , '>' , $w['subject'] , '</a></li>';
}

   echo '
</ul>
</marquee>
';
Title: Re: [Block] Recent topics with hover over previews.
Post by: prometheus fire on December 31, 2009, 09:02:05 PM
Wow- that's excellent. Works perfectly. I love how you set it up to display the most recent reply.

I can't see where to change the character limit though. The main tooltips (within the forums is pretty generous) is there a way to change that in here?

Also, this block doesn't parse the html links from the bbcode (it's embarassing to have the text of my affiliate links revealed). Is there some way to force that the way Nice Tooltips works inside the forums?

Update: I played around with several variations on using parse_bbc but didn't have any luck (though, frankly, I know nothing about php)
Title: Re: [Block] Recent topics with hover over previews.
Post by: Freddy on December 31, 2009, 09:17:06 PM
For the length of the body refer back to my original posting here :

http://www.tinyportal.net/index.php?topic=30884.msg246639#msg246639

You need to change the SSI.php file.

As for the bbc code - when I tried here with bold, it just strips out the tags, and when I use the url code, it just shows the text part, so I'm not sure why that is happening for you.

Can you give me an example of something that shows this behaviour ?  You can post it in a code block....
Title: Re: [Block] Recent topics with hover over previews.
Post by: prometheus fire on January 01, 2010, 05:32:09 AM
visit http://leafboxtea.com

The scrolling box on the right has this block code in it. I was able to adjust the SSI.php to increase the character limit.  I'll leave that block up until you respond before I switch it out again with my non-tooltip block.  But in it you can see how it fails to parse the bbc.  The URL shows up with it ignoring the text. It's pretty sloppy looking. Could this be because the character limit is too short causing it not to read the entire code and tags?

I'd love to get this tooltip feature functioning right since it'll certainly drive traffic further into my website
Title: Re: [Block] Recent topics with hover over previews.
Post by: Freddy on January 01, 2010, 12:40:59 PM
Mornin'.   Thanks for the link - I see what you mean from the first link in that list.

I've had a proper look at the SSI.php function and I think you are right - the database query is only gathering the first 384 characters, so this looks like it is causing the end of the bbc tags to be cut off.

I think I will try extracting the database query from SSI.php and adjusting it so it works the way we want.  This code can just go in a block, or that function you were using.  And then forget about using SSI.php too.

If it is done that way, I think this will also mean we can forget about that 128 character adjustment in SSI.php too - as it would then be using just the limit set by the mod.

I can't do this right away though, as I am just about to go out.  I will be back later tonight when I will take a better look at it.
Title: Re: [Discussion] Recent topics with hover over previews.
Post by: Freddy on January 02, 2010, 06:19:24 PM
OK, please don't post any more here about the scrolling box version, this thread is departing too much from the original subject.

So...here is the new thread for Prometheus' request for a scrolling recent topics block with hover over tips : http://www.tinyportal.net/index.php?topic=31639

Also this applies to everything so far;

I have found the problem with the bbc code also occurs when the ToolTips are used normally in a board - I mean 'out-of-the-box'...

So the best way to remedy that is for people ask the original mod maker to work on that bug.  The problem is that the mod only grabs a set length of characters from the database - so this means it can chop url's in half.   I think what they need to do is grab the whole of the post body from the database and then work out a way to do it within the NiceTooltip() function so that urls don't get chopped up.

Update : I think I have improved on what we have done so far - I stripped down the SSI.php code and put it in the actual block instead.  I also made it use the NiceToolTips settings to limit the characters.  So no more messing around with SSI.php - now it is all done in one handy block.

The code can be found here : http://www.tinyportal.net/index.php?topic=31642
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on January 09, 2010, 02:55:03 PM
nice work..

with a new code you wrote

// *********************************************************************
// A PHP block by Freddy888 and MrCare
// Used alongside the NiceToolTips mod, will show
// recent posts 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 : 3 Jan 2010
// *********************************************************************

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


global $scripturl, $settings, $modSettings, $db_prefix, $user_info, $ID_MEMBER;

// 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();

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

   
// Find all the posts in distinct topics.  Newer ones will have higher IDs.
// Stripped down from SSI.php ssi_recentTopics() function.

$request = db_query("
   SELECT
      m.posterTime, ms.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG, b.ID_BOARD, b.name AS bName,
      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, ". (!empty($modSettings['NiceTooltips_lenght']) ? $modSettings['NiceTooltips_lenght'] : 384) .") AS body, m.smileysEnabled
   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) ? '' : "
      AND b.ID_BOARD NOT IN (" . implode(', ', $exclude) . ")") . "
      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))
{
   // Build the array.
   $posts[] = array(
      'board' => array(
         'link' => '<a href="' . $scripturl . '?board=' . $row['ID_BOARD'] . '.0">' . $row['bName'] . '</a>'
      ),
      'topic' => $row['ID_TOPIC'],
      'poster' => array(
         'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'
      ),
      'subject' => $row['subject'],
      'preview' => $row['body'],
      'time' => timeformat($row['posterTime']),
      '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['isRead']),
   );
}

mysql_free_result($request);
   
   
// Now for the output...

echo '
   <table border="0" width="100%" cellspacing="1" cellpadding="3" class="bordercolor">
      <tr class="catbg3">
         <td align="center">Subject</td>
         <td align="center">Board</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">
            <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="New', $txt[302], '" border="0" align="right", valign="absmiddle" /></a>';
   
   echo '
         </td>
         <td valign="middle" >', $topic['board']['link'], '</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[111], '" title="', $txt[111], '" border="0" style="float: right;" /></a>';
   
   echo '
            <span class="smalltext">', $topic['time'], '</span>
         </td>
      </tr>';
}

echo '
   </table>';


i want to add :
1- msg icon
2- num replies
3- num views

hope u can help.

tq soo much  O0
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on January 10, 2010, 05:20:48 PM
Here's what I came up with ....

Screenshot attached...


// *********************************************************************
// 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 : 10 Jan 2010
// *********************************************************************

// Cofiguration, set the number of posts to show:

$num_recent = 8;

// Config end.


global $scripturl, $settings, $modSettings, $db_prefix, $user_info, $ID_MEMBER;

// 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();

$ex_aeva = empty($modSettings['aeva_enable']) ? 0 : 1;
$modSettings['aeva_enable'] = 0;
   
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');
$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 = 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, t.numViews,
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, ". (!empty($modSettings['NiceTooltips_lenght']) ? $modSettings['NiceTooltips_lenght'] : 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) ? '' : "
AND b.ID_BOARD NOT IN (" . implode(', ', $exclude) . ")") . "
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))
{
// Build the array.
$posts[] = array(
'board' => array(
'link' => '<a href="' . $scripturl . '?board=' . $row['ID_BOARD'] . '.0">' . $row['bName'] . '</a>'
),
'topic' => $row['ID_TOPIC'],
'poster' => array(
'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'
),
'subject' => $row['subject'],
'preview' => $row['body'],
'time' => timeformat($row['posterTime']),
'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['isRead']),
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
'viewsreplies' => $row['numViews'] . '/' . $row['numReplies'],
);
}

mysql_free_result($request);


// Now for the output...

echo '
<table border="0" width="100%" cellspacing="1" cellpadding="3" class="bordercolor">
<tr class="catbg3">
<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="New', $txt[302], '" 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[111], '" title="', $txt[111], '" border="0" style="float: right;" /></a>';

echo '
<span class="smalltext">', $topic['time'], '</span>
</td>
</tr>';
}

echo '
</table>';
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on January 11, 2010, 12:32:54 AM
very very nice work... tq

:smitten:

how about topic status? like normal topic,  hot topic icon ... etc?
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: IchBin on January 11, 2010, 02:15:36 AM
Good love Mrcare. Four pages of you requesting feature after feature. How about you think about this long and hard and make up your mind at what you actually want? lol This would be a lot easier for Freddie if he didn't have to keep coming back for every little thing I'm sure.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on January 11, 2010, 02:51:40 AM
Quote from: IchBinâ„¢ on January 11, 2010, 02:15:36 AM
Good love Mrcare. Four pages of you requesting feature after feature. How about you think about this long and hard and make up your mind at what you actually want? lol This would be a lot easier for Freddie if he didn't have to keep coming back for every little thing I'm sure.

tq..
i think to put topic the colum to show
Topic you have posted in
Normal Topic
Hot Topic (More than 10 replies)
Very Hot Topic (More than 15 replies)
Locked Topic
Sticky Topic
Poll

tq.. if its easier way to Freddie to make it im very glad.. if he cant/or have a problem to make it, im very glad now.. because what i want, is getting now.. tq for all...

Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on January 11, 2010, 01:32:54 PM
Yes I am afraid IchBin is right, I do get a bit fed up if people keep changing their mind and keep adding more and more things.  I'm not here to answer to people's every whim after all...

But anyway, Mrcare you have been polite and clear about what you want and I am happy to help you.  Just one question though - is this finally what you want ? lol
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on January 11, 2010, 01:51:08 PM
i think bit last question and last request about this topic...  :D

sorry to all.. and tq for all...

from tp lover...  :'(
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on January 11, 2010, 02:03:38 PM
hehe, do not feel bad MrCare, it just helps to keep things organised.  O0

I will work on this new feature in a while.  At the moment I am not sure how to do it so it may take a while.  Back later  ;)
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on January 11, 2010, 05:10:39 PM
OK here is what I came up with :

This will show the 'hot', 'very hot', 'locked' etc icons for each topic.


// *********************************************************************
// A PHP block by Freddy888 and MrCare
// !!Modified to show icon, number of views and replies.!!
// !!Modified to show topic class icons (hot, locked etc)!!
// 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 : 11 Jan 2010
// *********************************************************************

// Cofiguration, set the number of posts to show:

$num_recent = 8;

// Config end.


global $scripturl, $settings, $modSettings, $db_prefix, $user_info, $ID_MEMBER;

// 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();

$ex_aeva = empty($modSettings['aeva_enable']) ? 0 : 1;
$modSettings['aeva_enable'] = 0;
   
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');
$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 = 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, t.numViews, t.ID_POLL, t.isSticky, t.locked,
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, ". (!empty($modSettings['NiceTooltips_lenght']) ? $modSettings['NiceTooltips_lenght'] : 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) ? '' : "
AND b.ID_BOARD NOT IN (" . implode(', ', $exclude) . ")") . "
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();
$topic_ids = array();

while ($row = mysql_fetch_assoc($request))
{
// Build the array.
$posts[$row['ID_TOPIC']] = array(
'board' => array(
'link' => '<a href="' . $scripturl . '?board=' . $row['ID_BOARD'] . '.0">' . $row['bName'] . '</a>'
),
'topic' => $row['ID_TOPIC'],
'poster' => array(
'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'
),
'subject' => $row['subject'],
'preview' => $row['body'],
'time' => timeformat($row['posterTime']),
'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['isRead']),
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
'viewsreplies' => $row['numViews'] . '/' . $row['numReplies'],
'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,
);

// Get the class of the post (normal, hot, very hot etc)...
determineTopicClass($posts[$row['ID_TOPIC']]);

// Add this topic to the list of topic ids, so we can check later if the
// user has posted in this topic.
$topic_ids[] = $row['ID_TOPIC'];
}

mysql_free_result($request);

// Check if user has posted in a topic - adapted from MessageIndex.php
if (!empty($modSettings['enableParticipation']) && !$user_info['is_guest'] && !empty($topic_ids))
{
$result = db_query("
SELECT ID_TOPIC
FROM {$db_prefix}messages
WHERE ID_TOPIC IN (" . implode(', ', $topic_ids) . ")
AND ID_MEMBER = $ID_MEMBER
GROUP BY ID_TOPIC
LIMIT " . count($topic_ids), __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result))
{
$posts[$row['ID_TOPIC']]['is_posted_in'] = true;
$posts[$row['ID_TOPIC']]['class'] = 'my_' . $posts[$row['ID_TOPIC']]['class'];
}
mysql_free_result($result);
}




// Now for the output...

echo '
<table border="0" width="100%" cellspacing="1" cellpadding="3" class="bordercolor">
<tr class="catbg3">
<td align="center" colspan="3">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 class="windowbg2" valign="middle" align="center" width="5%">
<img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
</td>
<td class="windowbg2" valign="middle" align="center" width="5%">
' , $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="New', $txt[302], '" border="0" 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[111], '" title="', $txt[111], '" border="0" style="float: right;" /></a>';

echo '
<span class="smalltext">', $topic['time'], '</span>
</td>
</tr>';
}

echo '
</table>';
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Ken. on January 11, 2010, 05:47:01 PM
Nice. 
http://www.ourfamilyforum.org/tptest2/index.php?action=forum

Good job Freddy.  O0
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on January 11, 2010, 07:19:18 PM
Thanks Ken  :)
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on January 12, 2010, 03:37:20 AM
Nice coding with nicetooltips..  hmmm thanks to coder and for all to give me change - request then request until you all bore.. but i think you all dosn't fade up... hehe
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on January 12, 2010, 01:54:13 PM
You are welcome.    ;D
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: uniektekniek on January 19, 2010, 08:23:47 AM
Im getting an error when trying to save this code in a block... other codes are working fine... its only when this code is save that brings up the error..


Forbidden
You don't have permission to access /forum/index.php on this server

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.41 Server at nurcharecords.com Port 80


any ideas?
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on January 19, 2010, 01:41:35 PM
I guess you are saving it as a PHP block ?

Forum errors I am not great with - hopefully one of the other support members will be around soon to offer some help.  Hang in there.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: IchBin on January 19, 2010, 02:17:13 PM
The 404 error could be something to do with mod_security. There is a post at SMF that explains what to do for that error.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on March 06, 2010, 03:49:50 PM
how can exclude one or more topic/board from showing?
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on March 16, 2010, 08:42:17 AM
How can we change / limit topic character like 50 characters and then the other chracter of topic show ...
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on March 16, 2010, 01:02:03 PM
Could you give an example, I am not sure I fully understand you.  Do you mean the text that appears in the hover over block ?

If you do then that MOD has a setting for that - so check the settings.  If you want to do more than that you need to speak to the MOD maker.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on March 16, 2010, 01:38:43 PM
I re-read your message and I think I get what you mean.  You mean you want to limit the length of the preview ?

So for example like this :

QuoteLorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla auctor luctus diam. Nulla viverra odio imperdiet enim auctor non bibendum dui gravida. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In vehicula dictum libero eget accumsan...

With dots at the end ?

You can do that by changing the setting for that MOD in admin to however long you want the preview to be.

If you want to add '...' to the end of each one you could try this :

In the block code find :

// Generate the popup.
$popup = NiceTooltip($topic['preview'], $topic['subject']);


Change to :

// Generate the popup.
$popup = NiceTooltip($topic['preview'] . '...', $topic['subject']);


That should do it.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on March 16, 2010, 04:12:18 PM
i not mean the posting text.. but the topic exactly.. when the user make very long topic character.. i want to limit it to / like 50 character and then show ...
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on March 16, 2010, 04:21:02 PM
Can you show me a screen shot of what you want ?  Do you mean the subject ?
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: IchBin on March 16, 2010, 05:52:20 PM
I think what you're looking to do is this:
$popup = NiceTooltip(substr($topic['preview'], 0, 50), $topic['subject']);
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on March 16, 2010, 05:59:34 PM
Yeah you could do that, but I was trying to explain that you can easily set the character limit in the actual mod in the admin area.... which will do the same thing lol

Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on March 16, 2010, 09:30:57 PM
Quote from: IchBinâ„¢ on March 16, 2010, 05:52:20 PM
I think what you're looking to do is this:
$popup = NiceTooltip(substr($topic['preview'], 0, 50), $topic['subject']);
I mean for the topic title...

;)
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: IchBin on March 16, 2010, 09:34:17 PM
$popup = NiceTooltip($topic['preview'], substr($topic['subject'], 0, 50));
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on March 16, 2010, 09:36:42 PM
In other words the subject...

Try this :

$popup = NiceTooltip($topic['preview'], substr($topic['subject'], 0, 50) . '...');
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on March 16, 2010, 09:43:54 PM
Quote from: freddy888 on March 16, 2010, 09:36:42 PM
In other words the subject...

Try this :

$popup = NiceTooltip($topic['preview'], substr($topic['subject'], 0, 50) . '...');

yes got it..
but .. hehe
what i mean the subject in the block itself.. original subject.not preview. tq
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on March 17, 2010, 01:10:20 PM
You really need to explain things more fully my friend, as I told someone else today we are not mind readers...

Here you go, find this line :

<a href="' , $topic['href'] , '"' , $popup , '>' , $topic['subject'] , '</a>';

Change it to :

<a href="' , $topic['href'] , '"' , $popup , '>' , substr($topic['subject'], 0, 50) , '...</a>';

Just change the 50 until you get what you want.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on March 18, 2010, 02:30:57 AM
Quote from: freddy888 on March 17, 2010, 01:10:20 PM
You really need to explain things more fully my friend, as I told someone else today we are not mind readers...

Here you go, find this line :

<a href="' , $topic['href'] , '"' , $popup , '>' , $topic['subject'] , '</a>';

Change it to :

<a href="' , $topic['href'] , '"' , $popup , '>' , substr($topic['subject'], 0, 50) , '...</a>';

Just change the 50 until you get what you want.

sorry for all the trouble. but the existing short subject  also have [...] . So how to remove [...] from subjects who had an existing short subject?.

Again.. sorry my friend for the trouble...
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on March 18, 2010, 10:33:15 AM
Okay, try changing that line to this instead :

<a href="' , $topic['href'] , '"' , $popup , '>' , strlen($topic['subject']) > 50 ? substr($topic['subject'], 0, 50) . '...' : $topic['subject'] , '</a>';

That should do it.  :D

If you want to shorten them you will need to change both 50s.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on March 18, 2010, 01:30:55 PM
Quote from: freddy888 on March 18, 2010, 10:33:15 AM
Okay, try changing that line to this instead :

<a href="' , $topic['href'] , '"' , $popup , '>' , strlen($topic['subject']) > 50 ? substr($topic['subject'], 0, 50) . '...' : $topic['subject'] , '</a>';

That should do it.  :D

If you want to shorten them you will need to change both 50s.
wonderful. thank you for help
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on March 18, 2010, 02:36:40 PM
Sorted  ;D
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on April 10, 2010, 05:18:12 PM
Quote from: freddy888 on January 11, 2010, 05:10:39 PM
OK here is what I came up with :

This will show the 'hot', 'very hot', 'locked' etc icons for each topic.


// *********************************************************************
// A PHP block by Freddy888 and MrCare
// !!Modified to show icon, number of views and replies.!!
// !!Modified to show topic class icons (hot, locked etc)!!
// 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 : 11 Jan 2010
// *********************************************************************

// Cofiguration, set the number of posts to show:

$num_recent = 8;

// Config end.


global $scripturl, $settings, $modSettings, $db_prefix, $user_info, $ID_MEMBER;

// 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();

$ex_aeva = empty($modSettings['aeva_enable']) ? 0 : 1;
$modSettings['aeva_enable'] = 0;
   
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');
$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 = 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, t.numViews, t.ID_POLL, t.isSticky, t.locked,
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, ". (!empty($modSettings['NiceTooltips_lenght']) ? $modSettings['NiceTooltips_lenght'] : 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) ? '' : "
AND b.ID_BOARD NOT IN (" . implode(', ', $exclude) . ")") . "
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();
$topic_ids = array();

while ($row = mysql_fetch_assoc($request))
{
// Build the array.
$posts[$row['ID_TOPIC']] = array(
'board' => array(
'link' => '<a href="' . $scripturl . '?board=' . $row['ID_BOARD'] . '.0">' . $row['bName'] . '</a>'
),
'topic' => $row['ID_TOPIC'],
'poster' => array(
'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'
),
'subject' => $row['subject'],
'preview' => $row['body'],
'time' => timeformat($row['posterTime']),
'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['isRead']),
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
'viewsreplies' => $row['numViews'] . '/' . $row['numReplies'],
'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,
);

// Get the class of the post (normal, hot, very hot etc)...
determineTopicClass($posts[$row['ID_TOPIC']]);

// Add this topic to the list of topic ids, so we can check later if the
// user has posted in this topic.
$topic_ids[] = $row['ID_TOPIC'];
}

mysql_free_result($request);

// Check if user has posted in a topic - adapted from MessageIndex.php
if (!empty($modSettings['enableParticipation']) && !$user_info['is_guest'] && !empty($topic_ids))
{
$result = db_query("
SELECT ID_TOPIC
FROM {$db_prefix}messages
WHERE ID_TOPIC IN (" . implode(', ', $topic_ids) . ")
AND ID_MEMBER = $ID_MEMBER
GROUP BY ID_TOPIC
LIMIT " . count($topic_ids), __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result))
{
$posts[$row['ID_TOPIC']]['is_posted_in'] = true;
$posts[$row['ID_TOPIC']]['class'] = 'my_' . $posts[$row['ID_TOPIC']]['class'];
}
mysql_free_result($result);
}




// Now for the output...

echo '
<table border="0" width="100%" cellspacing="1" cellpadding="3" class="bordercolor">
<tr class="catbg3">
<td align="center" colspan="3">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 class="windowbg2" valign="middle" align="center" width="5%">
<img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
</td>
<td class="windowbg2" valign="middle" align="center" width="5%">
' , $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="New', $txt[302], '" border="0" 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[111], '" title="', $txt[111], '" border="0" style="float: right;" /></a>';

echo '
<span class="smalltext">', $topic['time'], '</span>
</td>
</tr>';
}

echo '
</table>';


i tried to put it with smf rc3 and tp 1.0 beta 5 but it show nothing. tq
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 10, 2010, 09:53:41 PM
Thanks MrCare, yes this won't work in SMF 2 because of the changes made in SMF 2.

Are you just reporting this or do you need help figuring it out ?
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Blue Steel on April 11, 2010, 04:42:09 AM
Hi,

I've got my php recent topics block with tooltip preview working now;)

Running TP 1.0 Beta5, SMF2 RC2 and NiceTooltips 1.6

I've got this php code block set up as my recent topics center block


// "Recent Topics" a php Block
// Prefered settings when being designed
// Border and title on
// Title ="Recent Topics"

global $context, $settings, $options, $scripturl, $txt, $modSettings, $sourcedir;

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>';

$what=ssi_recentTopics('40', NULL, 'array');

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

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

$what=ssi_recentTopics('10', NULL, 'array');
echo '<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">';
echo '<tr class="catbg2"><td valign="middle">Subject</td><td valign="middle">Board</td><td valign="middle">Poster</td><td valign="middle">Time</td></tr>';

foreach ($what as $topic)
  {
   // Generate the popup.
$popup = NiceTooltip($topic['preview'], $topic['subject']);

      echo '<tr><td class="windowbg2" valign="middle">';
      echo '<a href="', $topic['href'], '"', $popup , '>', $topic['subject'],' </a>', $topic['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $topic['topic'] . '.msg' . $topic['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt['new'] . '" border="0" /></a>';
      echo '</td><td class="windowbg2" valign="middle" >', $topic['board']['link'], '</td>';
      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="', $txt['last_post'], '" title="', $txt['last_post'], '" border="0" style="float: right;" /></a>';
      echo '<span class="smalltext">', $topic['time'], '</span></td></tr>';
  }

echo '</table>';

don't forget to set number of characters to display to more than 0. lol under admin > modifications < misacelanous .. LOL

Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on April 11, 2010, 11:43:52 PM
Quote from: freddy888 on April 10, 2010, 09:53:41 PM
Thanks MrCare, yes this won't work in SMF 2 because of the changes made in SMF 2.

Are you just reporting this or do you need help figuring it out ?

yes.. hope the tp coder can help.. tq
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on April 13, 2010, 05:32:39 PM
any progress for rc3?
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 13, 2010, 05:34:15 PM
Yes, I have been working on it but Real Life has taken me away.  I'll drop something in later...
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on April 13, 2010, 05:37:21 PM
Quote from: freddy888 on April 13, 2010, 05:34:15 PM
Yes, I have been working on it but Real Life has taken me away.  I'll drop something in later...
glad to hear this.. take ur time.. tq
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 13, 2010, 08:39:17 PM
OK here is something for you to test out.  I don't know much about the CSS styling of SMF 2 so I just used what I found for presentation.  So go ahead and customise the output as you like.

If this works for you then I will add it to the new snippets area.

Can you try testing to see if the 'new' icon works, I didn't get to that.

// *********************************************************************
// 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;

// 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();

$ex_aeva = empty($modSettings['aeva_enable']) ? 0 : 1;
$modSettings['aeva_enable'] = 0;
   
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');
$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 = tp_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 (" . implode(', ', $exclude) . ")") . "
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 = tpdb_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'],
);
}

tpdb_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>';
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on April 14, 2010, 03:00:18 AM
Quote from: freddy888 on April 13, 2010, 08:39:17 PM
OK here is something for you to test out.  I don't know much about the CSS styling of SMF 2 so I just used what I found for presentation.  So go ahead and customise the output as you like.

If this works for you then I will add it to the new snippets area.

Can you try testing to see if the 'new' icon works, I didn't get to that.

// *********************************************************************
// 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;

// 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();

$ex_aeva = empty($modSettings['aeva_enable']) ? 0 : 1;
$modSettings['aeva_enable'] = 0;
   
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');
$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 = tp_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 (" . implode(', ', $exclude) . ")") . "
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 = tpdb_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'],
);
}

tpdb_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>';


Yes.. everythings is soo good... very nice..

:D ;D O0
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 14, 2010, 09:14:32 AM
Glad to hear it  :)
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on April 18, 2010, 07:04:45 AM
one more things freddy..

how can we change the msg icon to
class of the post (normal, hot, very hot etc)...?
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 18, 2010, 02:11:32 PM
LOL, I sometimes wonder if you are ever going to make your mind up ;)

So you don't want the the message icon now ?

Do you want it to show both of them ?

Please think of my sanity  ;D
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on April 18, 2010, 04:15:09 PM
Quote from: freddy888 on April 18, 2010, 02:11:32 PM
LOL, I sometimes wonder if you are ever going to make your mind up ;)

So you don't want the the message icon now ?

Do you want it to show both of them ?

Please think of my sanity  ;D
:D
I want the topic icon.. like you make before.. i try it..but cant be done..
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 18, 2010, 05:54:00 PM
Here try this out.  I made it so you can configure it to display/not display both the message icon and the class icon.

Took me a while but that was quite interesting, I found out some more about SMF doing that one.  I used some of the SMF code for reference and adapted it to suit our needs.  It should show the whole range of class icons - like sticky, locked, hot, hot that you posted in....etc etc.

I've tested it quite a lot and it doesn't seem to throw any errors.


// *********************************************************************
// A PHP block by Freddy888 and MrCare
// !!Modified to show icon, number of views and replies.!!
// !!Modified to show or not show icon & show or not show message class!!
// 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 : 18 April 2010
// Note that this version is ONLY for SMF2.
// *********************************************************************

// Configuration

// set the number of posts to show:
$num_recent = 8;

// Show class ?  Hot topic, locked etc.. (true or false)
$show_class_icon = true;

// Show the icon for type of message ? Lamp, thumbs up, smiley etc (true or false)
$show_message_icon = true;

// Config end.


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

// 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();

$ex_aeva = empty($modSettings['aeva_enable']) ? 0 : 1;
$modSettings['aeva_enable'] = 0;
   
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');
$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 = tp_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, t.is_sticky, t.locked, t.id_poll,
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 (" . implode(', ', $exclude) . ")") . "
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__);


// An array to hold all the posts/new topics in.
$posts = array();

// use a counter for topics so we can track the index of the $posts array - if needed.
$topic_count = 0;

// Keeps track of topic ids found so we can see if the user posted in a topic - if needed.
$topic_ids = array();


while ($row = tpdb_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" />',
'views_replies' => $row['num_views'] . '/' . $row['num_replies'],
'is_sticky' => !empty($modSettings['enableStickyTopics']) && !empty($row['is_sticky']),
'is_locked' => !empty($row['locked']),
'is_poll' => $modSettings['pollMode'] == '1' && $row['id_poll'] > 0,
'is_hot' => $row['num_replies'] >= $modSettings['hotTopicPosts'],
'is_very_hot' => $row['num_replies'] >= $modSettings['hotTopicVeryPosts'],
);

// Are we showing the icon for class of topic ?  Otherwise ignore this part as it's not needed.
if ($show_class_icon == true)
{
// Use the SMF function that works out what icon class we need to show.
determineTopicClass($posts[$topic_count]);

// Add this topic to our array of topics being found.
$topic_ids[] = $row['id_topic'];

$topic_count++;
}
}

tpdb_free_result($request);

// Again, are we showing the message/topic class icon ?  Otherwise don't bother with this bit.
if ($show_class_icon == true)
{
// See if the user posted in any of the topics found.
$request = tp_query("
SELECT id_topic
FROM {$db_prefix}messages
WHERE id_topic
IN (" . implode(', ',$topic_ids) . ")
AND id_member = {$context['user']['id']}
GROUP BY id_topic
LIMIT " . count($topic_ids), __FILE__, __LINE__);

// Now we know what topics the user posted in we can put them in an array
// and refer to it when we do the output.
$posted_in = array();

while ($row = tpdb_fetch_assoc($request))
{
$posted_in[] = $row['id_topic'];
}
tpdb_free_result($request);
}


// Now for the output...

// Set the cell span for subject depending on the number of icons we have to show.
$col_span = 1;

if ($show_class_icon == true)
$col_span++;
if ($show_message_icon == true)
$col_span++;


echo '
<table border="0" width="100%" cellspacing="1" cellpadding="3" class="bordercolor">
<tr class="titlebg">
<td align="center" colspan="' , $col_span , '">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;

if ($show_class_icon == true)
echo '
<td valign="middle">
<img src="' , $settings['images_url'] , '/topic/' , (in_array($topic['topic'], $posted_in) ? 'my_' : '') , $topic['class'] , '.gif" alt="" />
</td>';

if ($show_message_icon == true)
echo '
<td valign="middle">
' , $topic['icon'] , '
</td>';

echo '
<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['views_replies'] , '</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>';
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: alhaudhie on April 19, 2010, 06:20:54 AM
< Edit by Freddy - there's no need to quote me when my response is directly above your post - quote removed :) >


Nothing to say.. but
Working greatest like before.. you are champs!!! tq
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Blue Steel on April 19, 2010, 06:35:22 AM
sorry to bother.. but heres my wish list for this great block

1. can/does it also show if theres an attachment ?
2. can you make it that the colums are sortable on user clicking title ASC/DESC ?
3. make Views/Replies Ccolum header smaller .. its taking up too much screen realestate just dead space in colum except for the header. (with the extra colums screen real estate is at a must to reduce where ever possible.. at least on my page)

Thanks for a great block
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 19, 2010, 02:57:32 PM
No problem, some good suggestions...

1. No it doesn't show attachments, but that could probably be added, it just means changing the database query I think, after glancing at it.

2. Sortable - not sure how useful that would be, how many topics are you planning to show ?  I guessed most people would display a max of around 12 topics... and to me that wouldn't need sorting.  How many are you thinking of ?  Other thoughts - this would mean a page refresh too and each page refresh means a new database call not just for the block but the whole page too.

3. View/Replies, yes I had noticed that myself.  I could apply a style to it I suppose so it is smaller text ? Or split the words over two lines with a line break - meaning the headings would get a little taller...probably not a big problem as height is less of a concern most of the time.   Consider also that I only used styling I found quickly in SMF 2, I don't know all the new CSS yet - so you could use a different class for the headings (which do appear a little large to me) as you see fit, or just apply your own in-line style.

Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 19, 2010, 04:19:47 PM
Actually I just found it can show attachments without modifying the SQL.

Change this line :

$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');

To this :

$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless', 'clip');

I just added 'clip' on the end so it picks up the clip gif.

If you have message icons set to display then it will show a paper clip icon.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Blue Steel on April 20, 2010, 12:12:16 AM
Members on my site use this block the most. its my main block on the front page . as my site is a coding site, members like to see messages in there that have been modified in at least the last week so i have mine set to show about 20-50 (I keep adjussting the number manually as the block can't show by age of message which would also be great if you could add that feature.
eg: instead on last xx messages .. messages altered within 7 days (configurable)

thanks for your new line of code.

At the moment i've put spaces between "Views/Replies" to "Views / Replies" to make it split over 2 lines this allowing wordwrap in there , but now the header bg isn't deep enough.. so i'm getting a little overflow
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 21, 2010, 03:09:53 PM
Quote from: BlueSteel on April 20, 2010, 12:12:16 AM
At the moment i've put spaces between "Views/Replies" to "Views / Replies" to make it split over 2 lines this allowing wordwrap in there , but now the header bg isn't deep enough.. so i'm getting a little overflow

I can't really think of any words to put in there that will do the same job.  Splitting it so it wraps is probably the best compromise.  For your overflow you could make a new longer graphic for the background and make a new CSS class for it.  Alternatively you could set the background just to use a colour.

I will look into the posts from x amount of days, that does sound useful :)

I can probably do the sortable columns, as long as you understand it will mean a lot more overhead.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 21, 2010, 08:55:43 PM
Okay I had a lot of fun with this, I think I have something usable now.

I got it to show topics from a set number of days.  So you can for example configure it to show topics from the last 7 days etc.  It uses the forum time too, so assuming your users are set up right with their time zones it should be accurate.  Even if they are not I think there is enough tolerance there.

Also, and this pleased me, I found some javascript made by a nice helpful guy that sorts HTML tables (http://www.kryogenix.org/code/browser/sorttable/) - so I managed to eliminate further page loads and refreshes.

One thing we can't do now is have alternating backgrounds for posts - that's because when the items get reordered it screws up the system for changing the background which was previously done with PHP.

I've tested this the best I can on a test forum and it hasn't been throwing any errors for me.

I reduced the size of the heading text, maybe that will help with that overflow problem.  I couldn't find a suitable SMF CSS class to use there; everything I found would only work for one line of text.  So if folks are not happy with it I suggest they make a new graphic and class for it like I said above.

One more thing - this particular version needs the javascript to work obviously.  I have zipped and attached the sorttable.js file you need.  Unzip that and drop the javascript file into your ....Themes/default/scripts folder with all the other scripts.

Image attached shows the table being sorted by topic subject.  All columns are sortable...

Have fun and let me know how you get on :)

Edit : Code removed...

Updated code with bug fix is a few pages ahead...click here... (http://www.tinyportal.net/index.php?topic=30884.msg261460#msg261460)

Same drill as before  ;)
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Ken. on April 21, 2010, 10:14:35 PM
Freddy, is this designed to be used just in a 'center' type of block?

Having it in a left block is giving me a scroll bar, of course I may have missed some of the discussion... Me is just now reading through the whole topic again.   :o
http://www.ourfamilyforum.org/SMF2.0/index.php


EDIT: for spelling and context.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 21, 2010, 10:28:55 PM
Yeah it needs a big block.  Really too big for a side block...
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Blue Steel on April 21, 2010, 10:32:03 PM
great thanks.. i'll try it out when i get back from droping my son at school
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Ken. on April 21, 2010, 10:35:02 PM
Thanks Freddy... this is great stuff. :up:

EDIT: Works great in an upper block Freddy. Unfortunately it can't be used on my live site because of the large images (banners actually) that are being used in place of board names.  ???
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Blue Steel on April 22, 2010, 01:27:28 AM
ok back.. working great..

only change i've made to seperate the messages a little was to change this line (about line 224)

from

      <tr class="windowbg">';

to

      <tr class="windowbg2">';


this way they are in a diff colour to the Background of the main table
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on April 22, 2010, 09:21:41 AM
Quote
// Used alongside the NiceToolTips mod, will show
// recent topics in a table with tool tip previews.
// Also requires sorttable.js which can be found at
// http://www.kryogenix.org/code/browser/sorttable/
// Drop the sorttable.js in your Themes/default/scripts directory

I wanted to give this block a try, but for the life of me I can't get it to work.  :(  I've installed the Nicetooltips package, and that's working fine.  Also downloaded the the attached sortable.js file from the bottom of your post, unzipped and dropped into my Themes/default/scripts directory.

When I try this in a upper block all I get is a blank white block with title above it, and it stops my right hand blocks from displaying.

Any ideas what I can try to resolve this please?  :smiley6600:

This was on my test site running SMF2 RC3 and TP 1.0b5.1 I also have this bridged with Coppermine 1.5RC if that makes a difference. ;)
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 22, 2010, 11:05:38 AM
Blue Steel, glad that's working for you there :)

Lurkalot, have you got any error messages in the error log ?

Try opening two windows/tabs  - one with error log and one with the page where the block is.

Clear the error log and refresh the page with the block to reload the page.

Then refresh the error log tab and see if it is generating any errors.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on April 22, 2010, 06:08:24 PM
Quote from: freddy888 on April 22, 2010, 11:05:38 AM

Lurkalot, have you got any error messages in the error log ?


Sorry for the late reply Freddy,

Done what you suggested, turned on the block and clicked my home page button, this is the error I get in the error log,

Quote
Type of error: Database 
http://cctestsite.info/forums/index.php?Database Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')
AND id_member = 1
GROUP BY id_topic
ORDER BY null
LIMIT 0' at line 4File: /home/xxxxxxxx/public_html/cctestsite.info/forums/Sources/Load.php(2105) : eval()'d code(48) : eval()'d code
Line: 184


Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 22, 2010, 06:20:38 PM
Hmm well that LIMIT 0 doesn't look right.

How have you got it configured ?  The number of days, topics etc... at the top.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 22, 2010, 06:24:22 PM
Can you cut and paste the config section...  so I can see exactly...thanks.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on April 22, 2010, 06:34:10 PM
Quote from: freddy888 on April 22, 2010, 06:20:38 PM

How have you got it configured ?


Configured?  :P   Now you might have stumbled upon something here.  I used code as is from your last post, thought it would work without any adjustment.  :embarrassed:
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 22, 2010, 06:35:06 PM
Yes well it should do lol

Tell me do you actually have any posts in your forum ?

Or possibly are all the posts by someone else and not you ?  ie nothing by admin - assuming you are logged in as admin...
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on April 22, 2010, 06:37:06 PM
Quote from: freddy888 on April 22, 2010, 06:35:06 PM
Yes well it should do lol

Tell me do you actually have any posts in your forum ?

Only about three, I got fed up with talking to myself.  :(
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 22, 2010, 06:42:14 PM
Is it just a normal board that anyone can see ?
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on April 22, 2010, 06:49:16 PM
Quote from: freddy888 on April 22, 2010, 06:42:14 PM
Is it just a normal board that anyone can see ?

Should be Freddy, http://cctestsite.info/forums/index.php?topic=1.0
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 22, 2010, 07:04:13 PM
Hmmm... well Difficult for me to sort it from here....want to set me up an account with ability to use PHP articles ?  You can PM me if you like.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 22, 2010, 07:12:00 PM
Actually I think I just figured it out.  If you left the settings as they were then it was looking for topics within the past 7 days.

And since your last post is more than 7 days ago it is not finding anything.

That's what is causing the problem with it not finding any topics.

Try changing :

$num_days = 7;

To :

$num_days = 30;

And I bet it starts working...

Edit : make it 30 I meant...sorry I put 3 originally.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on April 22, 2010, 07:24:19 PM
 O0 worked like a dream, thanks Freddy.

Only thing that concerns me is when there's no posts to show it stops my right panels from working, and throws the error. 

Is this a bug?  Not that it would show up on an active forum I suppose.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 22, 2010, 07:28:49 PM
Yeah, I consider it a bug really.  I'm just recoding it a little to pick up on that.

So that if there are no results it says something like :

"There are no topics from the past 7 days..."

Better to be safe than sorry.  Thanks for the bug hunting :)
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on April 22, 2010, 07:33:40 PM
Quote from: freddy888 on April 22, 2010, 07:28:49 PM

Better to be safe than sorry.  Thanks for the bug hunting :)


No problem, thanks for helping me with this.  ;)

Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 22, 2010, 07:49:36 PM
Here's a new version with the 'no results' bug fixed.


// *********************************************************************
// A PHP block by Freddy888 and MrCare
// !!Modified to show icon, number of views and replies.!!
// !!Modified to show or not show icon & show or not show message class!!
// !!Modified to show topics from a range of days passed!!
// !!Modified to enable sortable table !!
//
// Used alongside the NiceToolTips mod, will show
// recent topics in a table with tool tip previews.
// Also requires sorttable.js which can be found at
// http://www.kryogenix.org/code/browser/sorttable/
// Drop the sorttable.js in your Themes/default/scripts directory.

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

// This version : 21 April 2010
// Note that this version is ONLY for SMF2.
// *********************************************************************

// Configuration

// Set the number of posts to show..
$num_recent = 8;

// Alternatively set here a range of days passed.
// eg , 7 will get all the topics in the past 7 days.
// This will over-ride $num_recent above.  Set to 0 to disable.
$num_days = 7;

// Show class ?  Hot topic, locked etc.. (true or false)
$show_class_icon = true;

// Show the icon for type of message ? Lamp, thumbs up, smiley etc (true or false)
$show_message_icon = true;

// Config end.


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

// Include Javascript
echo '<script src="' , $settings['default_theme_url'] , '/scripts/sorttable.js"></script>';

// 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';

// Are we looking for topics within a number of days ?
if ($num_days != 0)
$date_threshold = forum_time() - ($num_days * 24 * 60 * 60);

// Find all the posts in distinct topics.  Newer ones will have higher IDs.
// Stripped down and adapted from SSI.php ssi_recentTopics() function.

$request = tp_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, t.is_sticky, t.locked, t.id_poll,
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 (" . implode(', ', $exclude) . ")") . "
AND $user_info[query_see_board]
AND ms.id_msg = t.id_first_msg"
. (($num_days != 0) ? "
AND m.poster_time > $date_threshold" : "") . "
ORDER BY t.id_last_msg DESC"
. (($num_days == 0) ? "
LIMIT $num_recent" : ""), __FILE__, __LINE__);


// An array to hold all the posts/new topics in.
$posts = array();

// use a counter for topics so we can track the index of the $posts array - if needed.
$topic_count = 0;

// Keeps track of topic ids found so we can see if the user posted in a topic - if needed.
$topic_ids = array();


while ($row = tpdb_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']),
'time_stamp' => $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" />',
'icon_type' => $row['icon'],
'views_replies' => $row['num_views'] . '/' . $row['num_replies'],
'is_sticky' => !empty($modSettings['enableStickyTopics']) && !empty($row['is_sticky']),
'is_locked' => !empty($row['locked']),
'is_poll' => $modSettings['pollMode'] == '1' && $row['id_poll'] > 0,
'is_hot' => $row['num_replies'] >= $modSettings['hotTopicPosts'],
'is_very_hot' => $row['num_replies'] >= $modSettings['hotTopicVeryPosts'],
);

// Are we showing the icon for class of topic ?  Otherwise ignore this part as it's not needed.
if ($show_class_icon == true)
{
// Use the SMF function that works out what icon class we need to show.
determineTopicClass($posts[$topic_count]);

// Add this topic to our array of topics being found.
$topic_ids[] = $row['id_topic'];

$topic_count++;
}
}

tpdb_free_result($request);

// Okay then, did that return any results ?
if (count($topic_ids) > 0)
{
// Again, are we showing the message/topic class icon ?  Otherwise don't bother with this bit.
if ($show_class_icon == true)
{
// See if the user posted in any of the topics found.
$request = tp_query("
SELECT id_topic
FROM {$db_prefix}messages
WHERE id_topic
IN (" . implode(', ',$topic_ids) . ")
AND id_member = {$context['user']['id']}
GROUP BY id_topic
LIMIT " . count($topic_ids), __FILE__, __LINE__);

// Now we know what topics the user posted in we can put them in an array
// and refer to it when we do the output so it shows the special 'my_' icons.
$posted_in = array();

while ($row = tpdb_fetch_assoc($request))
{
$posted_in[] = $row['id_topic'];
}
tpdb_free_result($request);
}


////////////////////////
// Now for the output...


// Set up the table and headings.
echo '
<table class="sortable" border="0" width="100%" cellspacing="1" cellpadding="3">
<tr class="titlebg" style="font-size:11px;cursor:hand;cursor:pointer">'
, ($show_class_icon ? '
<th></th>' : '')
, ($show_message_icon ? '
<th></th>' : '') , '
<th align="center">Subject</th>
<th align="center">Board</th>
<th align="center">Views/Replies</th>
<th align="center">Member</th>
<th align="center">Date & Time</th>
</tr>';

// Go through each topic.
foreach ($posts as $topic)
{
// Generate the popup.
$popup = NiceTooltip($topic['preview'], $topic['subject']);

echo '
<tr class="windowbg">';


if ($show_class_icon == true)
{
if (in_array($topic['topic'], $posted_in))
$topic['class'] = 'my_' . $topic['class'];

echo '
<td sorttable_customkey = "' , $topic['class'] , '" valign="middle">
<img src="' , $settings['images_url'] , '/topic/' , $topic['class'] , '.gif" alt="" />
</td>';
}

if ($show_message_icon == true)
echo '
<td sorttable_customkey = "' , $topic['icon_type'] , '" valign="middle">
' , $topic['icon'] , '
</td>';

echo '
<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['views_replies'] , '</td>';

echo '
<td valign="middle" >', $topic['poster']['link'], '</td>
<td sorttable_customkey = "' , $topic['time_stamp'] , '" 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>';

}
else // If there were no results do this...
{
if ($num_days)
{
echo '
<div style="text-align:center">
<em>There have been no posts in the past ' , $num_days , ' days...</em>
</div>';
}
else
{
echo '
<div style="text-align:center">
<em>There appears to be no posts in the forum !</em>
</div>';
}
}
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on April 22, 2010, 07:54:35 PM
Thanks, tested and working for me. ;)

There have been no posts in the past 7 days...   O0
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 22, 2010, 07:56:29 PM
Bingo  ;D
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Ken. on April 22, 2010, 10:26:02 PM
Quote from: freddy888 on April 22, 2010, 07:56:29 PM
Bingo  ;D

Ditto!!!  :coolsmiley:
http://www.ourfamilyforum.org/SMF2.0/index.php?action=forum
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 23, 2010, 01:32:33 PM
Cool,  I'll add the code to the block post later then.   :)
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Dramber on April 26, 2010, 10:35:33 PM
The code for SMF 1.1.11 works Great!
One section made me pull a bit of hair out though.

In the exclude the recycle folder bit there is a section for Aeva:
$ex_aeva = empty($modSettings['aeva_enable']) ? 0 : 1;
$modSettings['aeva_enable'] = 0;


Leaving this in turns off ALL Aeva lookups for the Frontpage. I'm not sure if I fixed it correctly or not but I added in:
$ex_aeva = empty($modSettings['aeva_enable']) ? 0 : 1;
$modSettings['aeva_enable'] = 1;

At the end of the code. Everything seems to be working ok on my end.
Thanks for the great block!
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Blue Steel on April 26, 2010, 10:42:15 PM
why is that code even in there when the Recent Topics Doesn't even use Avea ??
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on April 27, 2010, 02:28:39 PM
Heheh, yeah that shouldn't even be in there.  The reason it is there is because the person who requested the original block had got to a point where they didn't know what to do next and then I took over the code.  I wasn't sure why those Aeva lines were there at the time so I left them alone and then they ended up being left in the code for no reason.

So yes, just remove those two Aeva lines - I will remove them from my snippets now too.   Thanks for bringing that to my attention and sorry I had you pulling your hair out !
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: coot on May 03, 2010, 01:13:16 AM
I have tried to use any of the Recent hovering blocks you created but I get a:
You don't have permission to access /index.php on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


when i try to save the block.  I have added other block snippets and they all save fine but there is something on this code that my host doesnt like. Any Ideas?



EDIT:  Any of these Recent Post snippets on here I have tried do the same thing, only Bloc's built in snippet works for me on SMF2RC3 w/ tp 1.0 beta 5-1
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: IchBin on May 03, 2010, 05:30:35 AM
That error you posted has something to do with a server setting called mod_security I think. You'll need to see if you can disable this on your server. There's a post about that error at SMF by Unknown if you search for it.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: MrCare on October 29, 2010, 03:17:52 AM
I found in this site that is using ronded corner for the preview box.. how to make it?
Title: Re: Recent Topics Style
Post by: agent47 on December 18, 2010, 12:02:38 PM
I'm sorry for posting a reply even though this has been marked solved
As I'm an utter noob at coding I was wondering how do I remove the number of page views from this block. As in what are the lines I gotta remove?
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: ZarPrime on December 18, 2010, 04:33:02 PM
agent47,

I split your last post and merged it into this topic.  It should be a matter of just looking through the code that you are using and removing the calls to anything that references "Views".  Why don't you try it out and if you have trouble with it, one of us can help you out.

ZarPrime
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: agent47 on December 18, 2010, 07:21:24 PM
Quote from: ZarPrime on December 18, 2010, 04:33:02 PM
agent47,

I split your last post and merged it into this topic.  It should be a matter of just looking through the code that you are using and removing the calls to anything that references "Views".  Why don't you try it out and if you have trouble with it, one of us can help you out.

ZarPrime
Actually mate the reason I ask is because I tried and everytime I seem to be breaking something LoL. I have to be honest with you guys, I truly know nothing about coding. Nada! So any help would be deeply appreciated. :)
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: ZarPrime on December 19, 2010, 07:29:25 AM
Well, this is Freddy's code but it shouldn't be too difficult to figure out.  You just want to show "replies" rather than "views/replies", right?  You probably just need to remove views from the query and the array and then make sure that you are not echoing those out.

Can you tell me which code you are using from this topic? --> http://www.tinyportal.net/index.php?topic=31642

There are 3 different versions there.  Actually, just post the code exact code that you are using (in code tags - #) here and I'll take a look at it.

ZarPrime
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: agent47 on December 19, 2010, 10:44:20 AM
// *********************************************************************
// 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 = 20;

// Config end.


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

// 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 = tp_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,
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 (" . implode(', ', $exclude) . ")") . "
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 = tpdb_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" />',
$row['num_replies'],
);
}

tpdb_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">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>';

I know it's pretty easy but one line is kinda confusing as I don't know what EXACTLY I have to remove off it.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on December 19, 2010, 11:05:47 AM
Give this a try.  I'm no coder, but gave it a shot.  ;)

Edited post to remove my code.  Cause I messed it up. lol..  :uglystupid2:
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: agent47 on December 19, 2010, 07:00:04 PM
hehe that removed both, views and replies. I only want to remove "VIEWS" mate :)
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on December 19, 2010, 08:08:10 PM
 :-[ :-[ :-[  :uglystupid2:

Doh, back to the drawing board then. lol...   I'll play some more.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: IchBin on December 20, 2010, 03:50:13 AM
This is the line that shows both replies and views.
'viewsreplies' => $row['num_views'] . '/' . $row['num_replies'],

To remove the views.
'viewsreplies' => $row['num_replies'],
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on December 20, 2010, 03:33:05 PM
Thanks Brad.  ;)  I've edited the two lines to remove the views.

agent47, This code should work nicely now.  ;)


// *********************************************************************
// 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;

// 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 = tp_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 (" . implode(', ', $exclude) . ")") . "
      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 = tpdb_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_replies'],
   );
}

tpdb_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">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>';
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: agent47 on December 20, 2010, 03:48:59 PM
You guys never seize to amaze me. I owe so much to you guys. Thanks alot you'll :)
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Lesmond on December 20, 2010, 04:20:56 PM
WE try our best agent47,  8)

<<<----- Have you noticed the Donate Button ;)  ::)

/me hides
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on January 31, 2011, 01:35:22 PM
agent47 asked me about the widths of the table cells, and I am posting here for other people's benefit too...

In the code, depending on what version you are using, you will find something like this :

<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>';



If you want to limit the width of some columns, simply add a width attribute to the top cells....

<tr class="titlebg">
<td width="200" align="center" colspan="2">Subject</td>
<td width="100" align="center">Board</td>
<td align="center">Views/Replies</td>
<td align="center">Member</td>
<td align="center">Date & Time</td>
</tr>';


Notice :

<td width="200" align="center" colspan="2">Subject</td>

So now the Subject column will have a width of 200 pixels, and the Board column will have a width of 100 pixels.

Some more help here :

http://www.web-source.net/web_design_tips/setting_html_table_column_widths.htm
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on January 31, 2011, 02:21:53 PM
Different problem regarding restricting certain boards.

If I remember right some of this code was already written before I got to it.  Anyway to do that, remove this set of lines (which don't seem that helpful anyway) :

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


And add something like this to the configuration area :

// Cofiguration, set the number of posts to show:

$num_recent = 8;

// Set boards to exclude.
$exclude = array(3,4,5,6);

// Config end.


You will see I added the line $exclude = array(3,4,5,6);

Just list the boards to exclude in the same way, comma separated, and it should ignore them.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on February 14, 2011, 09:22:39 PM
Freddy. 

I'm using this code posted below, which looks great on my site.  One of my members has pointed out, that if they click on the "new.gif"  icon in the subject line it takes them to the first post in the thread instead of the last.  Click on the subject and it will take you to the last post in the thread.  Any way of fixing this please?


// *********************************************************************
// 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;

// 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 = tp_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 (" . implode(', ', $exclude) . ")") . "
      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 = tpdb_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'],
   );
}

tpdb_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>';
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on February 14, 2011, 09:31:01 PM
How do you want me to fix it ?
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on February 14, 2011, 09:45:11 PM
OK, I'll rephrase my question, lol...

Is that how it's supposed to work?  ;)

As it's a latest posts block, I'd have thought clicking on the new icon would take you to the latest post.  As clicking on the subject text does.  Shouldn't they both point to the same place?
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on February 14, 2011, 10:38:58 PM
lol I don't know I think that was requested probably...

Give me a few minutes...
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on February 14, 2011, 10:42:33 PM
Try replacing :

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>';


with :

echo '
            <a href="' , $topic['href'] , '"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt['new'], '" border="0" align="right", valign="absmiddle" /></a>';
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on February 14, 2011, 11:27:45 PM
Thanks Freddy, I think that fixed it. ;)
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on February 15, 2011, 12:29:03 PM
Welcome :)
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: shuban on April 26, 2011, 10:02:00 PM
This mod works great but it only works on chrome and firefox, not Stupid internet explorer, what should I do?
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on April 26, 2011, 10:14:07 PM
Quote from: shuban on April 26, 2011, 10:02:00 PM
This mod works great but it only works on chrome and firefox, not Stupid internet explorer, what should I do?

Must be some problem with your setup.  This works fine for me in IE8.  I'm using it on my own site.   Which code are you using please?  And what versions of SMF and TP ?? 
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: dbailey on May 10, 2011, 12:35:26 PM
I have this in my upper panel block. The problem is guests can see it and access my forum through it. I have unticked guests where it says 'Choose your membergroups that will able to see this block. ' But it is still there when logged out. (I have tried other machines to test and it is still there).

If I untick 'let guests browse my forum' in the smf settings other features of the site will not work, so that is not an option.

If I move it to another block then it disappears, but I want it in the upper panel.

Any ideas on how to fix it please?
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: ZarPrime on May 10, 2011, 01:07:22 PM
dbailey,

You didn't report what versions of SMF and TinyPortal you are using but ...

This is an issue in the latest version of TP which has been fixed for TinyPortal 1.0 RC2 (not yet released)
Link is here --> http://www.tinyportal.net/index.php?issue=42.0
    Status changed from Assigned to Resolved
    Fixed Version changed from (none) to TP v1.0 RC2

ZarPrime
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: IchBin on May 10, 2011, 02:51:01 PM
Yes and I posted a fix here:
http://www.simplemachines.org/community/index.php?topic=27642.msg2947765#msg2947765
Title: Re: [Discussion] Recent topics table with hover over previews. (SOLVED)
Post by: dbailey on May 12, 2011, 08:51:29 AM
Thanks guys YOU ARE LEGENDS ;) works perfectly.  O0
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Dramber on June 14, 2011, 01:27:12 AM
Getting an error with this block after updating to tp to rc2 on my SMF 2.0 forums.

Fatal error: Call to undefined function tp_query() in /smf/Themes/default/TPsubs template php(114) : eval()'d code on line 80

Just disabling it for now till you get a chance to look at what might be causing it. ;)
No rush.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: ZarPrime on June 14, 2011, 04:15:48 AM
Dramber,

Yes, this is one of the expected side effects of the following ...

Quote from: IchBinâ,,¢ on June 13, 2011, 11:28:27 PM
  • Updated TP sources for SMF2 to use $smcFunc.

All block code snippets that used "tp_query" in the past will need to be updated to use the new functions by one of our coders as we find the time to do so.  This will take a little while.  Freddy or someone else will get to this as we find the time.

ZarPrime
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Dramber on June 14, 2011, 06:03:34 AM
No worries. :)
I can wait. Other than that my upgrade went flawlessly. You guys rock!
Thanks for all your hard work.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: ZarPrime on June 14, 2011, 06:11:46 AM
I'm glad everything else went well.  One of us will get on that block code shortly but give it a little time. ;)

ZarPrime
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on June 14, 2011, 07:51:52 AM
Here's the one I use, Brad has already converted it for me.  O0


// *********************************************************************
// 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>';
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Dramber on June 14, 2011, 12:45:38 PM
Thanks!
That's just what I wanted. Works like a charm.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: ZarPrime on June 14, 2011, 12:48:42 PM
Perfect. O0

ZarPrime
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on June 14, 2011, 12:57:08 PM
Added this to the code page, thanks  O0
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: MrCare on November 03, 2011, 11:39:05 AM
how can we put another colum that we can put (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Ft0.gstatic.com%2Fimages%3Fq%3Dtbn%3AANd9GcTbI-WKpnlc4EyUizf2aIhUHZIpObTURVFm0cw7V0gsnHoqE4C6&hash=805543028e6c3d011eac04d48650060bd33fda92) . Users can click that and share that topic in their facebook.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Freddy on November 04, 2011, 03:15:05 PM
Google would have got you there :

http://developers.facebook.com/docs/share/
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: jarska on January 20, 2012, 09:25:48 AM
Nice, thank you!
What to do if I want hovering and show only members avatar, like TP recent topics? ::)
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: thechamp on January 29, 2012, 07:49:07 PM
Quote from: lurkalot on June 14, 2011, 07:51:52 AM
Here's the one I use, Brad has already converted it for me.  O0


// *********************************************************************
// 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
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: MinatO on February 07, 2012, 07:30:16 PM
Quote from: lurkalot on June 14, 2011, 07:51:52 AM
Here's the one I use, Brad has already converted it for me.  O0


// *********************************************************************
// 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!
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on February 07, 2012, 09:35:25 PM
Quote from: MinatO on February 07, 2012, 07:30:16 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? 
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on August 26, 2012, 05:28:29 PM
A question for Freddy, or anyone else who can help me. ;)

I'm using this (http://www.tinyportal.net/index.php?topic=31642.msg260654#msg260654) block at the bottom of both my sites, which works great for my main site and testsite when using the SMF default theme.

But if you use a dark theme, like the one on my new site,  http://guitaristguild.com  the titles above each column are the wrong colour and get lost in the background.  Any ideas how I can change these please?  Need them to be white.  See it at bottom of page. ;)
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Maxx1 on August 26, 2012, 07:36:25 PM
OK bro in your index.css find this and change the color comment from #444444 to #FFFFFF:

.titlebg, .titlebg2, tr.titlebg th, tr.titlebg td, tr.titlebg2 td {
    background: url("../images/theme/main_block.png") no-repeat scroll -10px -200px transparent;
    color: #444444;   <!--- this color code to #FFF -->
    font-size: 1em;
    font-weight: normal;
}


looking good bro!

regards,
maxx
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: lurkalot on August 26, 2012, 07:55:22 PM
Quote from: Maxx1 on August 26, 2012, 07:36:25 PM
OK bro in your index.css find this and change the color comment from #444444 to #FFFFFF:

.titlebg, .titlebg2, tr.titlebg th, tr.titlebg td, tr.titlebg2 td {
    background: url("../images/theme/main_block.png") no-repeat scroll -10px -200px transparent;
    color: #444444;   <!--- this color code to #FFF -->
    font-size: 1em;
    font-weight: normal;
}


looking good bro!

regards,
maxx

Thanks Maxx, that fixed it.  O0  I looked at that code this morning in firebug, and even changed it on the fly to preview the changes, which did work.  Then I went to edit the actual css file and the code is different from what firebug shows.  That gave me a headache. lol..

This is my code


.titlebg, .titlebg2, tr.titlebg th, tr.titlebg td, tr.titlebg2 td

{

color: #FFF;

font-size: 1em;

font-weight: normal;

background: url(../images/theme/main_block.png) no-repeat -10px -200px;

}
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: Maxx1 on August 26, 2012, 08:10:18 PM
It happens Bro!

Glad you got it!

regards,
Maxx
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: MrCare on November 07, 2013, 02:57:36 PM
try to change
$num_recent = 8;

to

$num_recent = 100;

but its limit only to show 50

how to resolve this?
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: IchBin on November 07, 2013, 03:50:10 PM
I can only assume you are using the code from the first post since you didn't provide any information for us to know. This code uses an SSI function which is built into SMF. If there is any limit being imposed on the results, you'll likely have to modify the SMF code in SSI.php.
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: MrCare on February 04, 2014, 03:17:26 AM
How to add in every subject link... facebook share icon?
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: ZarPrime on February 04, 2014, 06:55:21 PM
Quote from: MrCare on February 04, 2014, 03:17:26 AM
How to add in every subject link... facebook share icon?

Huh?  MrCare, I have no idea what you are talking about.  As Ichbin said above ...

Quote from: IchBin™ on November 07, 2013, 03:50:10 PM
I can only assume you are using the code from the first post since you didn't provide any information for us to know.

MrCare, I don't mean to sound rude but you have been here long enough to know that none of the Team Members here are Clairvoyant or can read what is in the mind of members who ask us to help them do something.  It's not that we mind helping you because it's what we are here for, but it's difficult enough trying to do things to help people without having to decipher what they are asking for in the first place, especially since we are all volunteers here.  You can't possibly expect any of us to understand what "How to add in every subject link... facebook share icon?" means.  Let's start with this ...

Code (#1--> Answer these Questions !!!) Select
[b]Link to my forum:[/b] http://www.yourdomain.com/forum/
[b]SMF version:[/b] SMF ver. here
[b]TP version:[/b] TP ver. here
[b]Default Forum Language:[/b] Your Default Forum Language here
[b]Theme name and version:[/b] Theme name here
[b]Browser Name and Version: [/b] Browser name/version here
[b]Mods installed:[/b] Mods listed here
[b]Related Error messages:[/b] Error message here


Code (#2 --> Answer this Question !!!) Select
[b]What Code Are You Using?[/b]

Code (#3 --> Do This!!!) Select
[b]Create a screenshot mockup of exactly what it is you are trying to accomplish.[/b]

Code (#4 --> And, Finally, Answer this Question !!!) Select
[b]What exactly are you trying to accomplish, keeping in mind that "How to add in every subject link... facebook share icon?" tells us nothing?[/b]

Code (#5 --> Here's your Bonus Homework !!!) Select
Read the entire website linked right below this code box and the topic linked below that.  There will be a Pop Quiz later, to see what you have learned !!!

How To Ask Questions The Smart Way (http://www.catb.org/~esr/faqs/smart-questions.html)
Please read the Posting Guidelines (http://www.tinyportal.net/index.php?topic=581)

Help us to help you, ALWAYS !!!
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: MrCare on October 21, 2014, 06:37:08 AM
At the top of code i add

/ 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...
echo  '<div style="width: 100%; height: 356px; overflow: auto">'; 
if (!isset($_GET['board']) || isset($_GET['topic']))

i want to change scrollbar style to custom one.
its look like from http://baijs.nl/tinyscrollbar/ or http://manos.malihu.gr/repository/custom-scrollbar/demo/examples/scrollbar_themes_demo.html or etc... hope someone can help. tq
Title: Re: [Discussion] Recent topics table with hover over previews.
Post by: IchBin on October 23, 2014, 12:08:43 AM
That website shows you how to implement the scrollbar.
http://manos.malihu.gr/jquery-custom-content-scroller/#get-started-section

Put the code that into your block code. Then put content as class of section that you want to have a custom scrollbar. Not sure how well it will work, since it asks you to put stuff in the header. Since you can't do that, just put those lines at the top of your block code and see if they work.