Welcome, Guest. Please login or register.
Did you miss your activation email?
April 18, 2014, 07:34:47 AM

Login with username, password and session length

Last 25 Topics



Note:  Clicking the link above will open a new tab in your browser !!

Recent

Members
  • Total Members: 3398
  • Latest: dekrelo
Stats
  • Total Posts: 173425
  • Total Topics: 19802
  • Online Today: 59
  • Online Ever: 278
  • (October 31, 2012, 08:52:18 AM)
Users Online
Users: 0
Guests: 40
Total: 40

Donate

Help us to keep the support site
going, Please consider a small donation.

Thank you
Please read the Posting Guidelines

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

0 Members and 1 Guest are viewing this topic.

alhaudhie

  • Guest
[Discussion] Recent topics table with hover over previews.
« on: September 14, 2009, 09:58:20 AM »
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...

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

Original request....


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


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
Code: [Select]
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>'
« Last Edit: January 03, 2010, 01:18:53 AM by freddy888 »

Offline Freddy

  • Moderator
  • *
  • Posts: 1546
    • AiDreams
[Block] Recent topics with hover over previews.
« Reply #1 on: September 14, 2009, 12:11:32 PM »
There are errors in your code, but I will take a look at this.

Offline Freddy

  • Moderator
  • *
  • Posts: 1546
    • AiDreams
[Block] Recent topics with hover over previews.
« Reply #2 on: September 14, 2009, 01: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 :

Code: [Select]
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)

Code: [Select]
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.
« Last Edit: September 14, 2009, 01:45:58 PM by freddy888 »

Offline IchBin™

  • Developer
  • *
  • Posts: 16074
    • My Website
[Block] Recent topics with hover over previews.
« Reply #3 on: September 14, 2009, 02: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.

NCSurfer

  • Guest
[Block] Recent topics with hover over previews.
« Reply #4 on: September 14, 2009, 05:59:29 PM »
Freddy, Ichbin the code that you came up with along with the Nice Tooltips MOD worked great.

Thanks

Offline Freddy

  • Moderator
  • *
  • Posts: 1546
    • AiDreams
[Block] Recent topics with hover over previews.
« Reply #5 on: September 15, 2009, 03: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 :)

alhaudhie

  • Guest
[Block] Recent topics with hover over previews.
« Reply #6 on: September 15, 2009, 11:00:21 AM »
finally i got it... thank you soo much.. nice helper...

Offline Freddy

  • Moderator
  • *
  • Posts: 1546
    • AiDreams
[Block] Recent topics with hover over previews.
« Reply #7 on: September 15, 2009, 11:09:06 AM »
Glad you got it sorted  :)

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

Code: [Select]
$what=ssi_recentTopics('10', NULL, 'array');
So just change 10 to however many you need.
« Last Edit: September 15, 2009, 11:20:37 AM by freddy888 »

NCSurfer

  • Guest
Re: [Block] Recent topics with hover over previews.
« Reply #8 on: September 21, 2009, 04:23:06 PM »
I do have one more question in regards to this statement Freddy...

Quote
You 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

Offline IchBin™

  • Developer
  • *
  • Posts: 16074
    • My Website
Re: [Block] Recent topics with hover over previews.
« Reply #9 on: September 21, 2009, 11:20:20 PM »
SSI.php is in the top level of your forum. The root directory.