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

Recent

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

August 12, 2022, 05:41:43 PM

Login with username, password and session length
Members
  • Total Members: 3842
  • Latest: Kokoro
Stats
  • Total Posts: 193479
  • Total Topics: 21088
  • Online today: 50
  • Online ever: 1035
  • (November 26, 2020, 04:45:12 AM)
Users Online
Users: 0
Guests: 42
Total: 42

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

0 Members and 1 Guest are viewing this topic.

alhaudhie

  • Guest
Re: [Block] Recent topics with hover over previews.
« Reply #20 on: December 18, 2009, 09:40:59 AM »
This code

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

dosn't show / can't show bbc code in full funtion.

Offline Freddy

  • Moderator
  • *
  • Posts: 1615
    • AiDreams
Re: [Block] Recent topics with hover over previews.
« Reply #21 on: December 18, 2009, 09:48:14 AM »
Try changing this line :

Code: [Select]
$popup = NiceTooltip($topic['preview'], $topic['subject']);
To this :

Code: [Select]
$popup = NiceTooltip(parse_bbc($topic['preview']), $topic['subject']);

alhaudhie

  • Guest
Re: [Block] Recent topics with hover over previews.
« Reply #22 on: December 18, 2009, 09:34:36 PM »
same result after test. tq

alhaudhie

  • Guest
Re: [Block] Recent topics with hover over previews.
« Reply #23 on: December 19, 2009, 08:46:23 AM »
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?

Offline Freddy

  • Moderator
  • *
  • Posts: 1615
    • AiDreams
Re: [Block] Recent topics with hover over previews.
« Reply #24 on: December 19, 2009, 09:57:25 AM »
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 ?

alhaudhie

  • Guest
Re: [Block] Recent topics with hover over previews.
« Reply #25 on: December 19, 2009, 04:32:42 PM »
no problem at all..

i will wait for u or someone else to rerwrite it. tq

prometheus fire

  • Guest
Re: [Block] Recent topics with hover over previews.
« Reply #26 on: December 31, 2009, 09:03:50 AM »
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.

Code: [Select]
// 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>';

}

Offline Freddy

  • Moderator
  • *
  • Posts: 1615
    • AiDreams
Re: [Block] Recent topics with hover over previews.
« Reply #27 on: December 31, 2009, 10:00:57 AM »
Working on this....

Offline Freddy

  • Moderator
  • *
  • Posts: 1615
    • AiDreams
Re: [Block] Recent topics with hover over previews.
« Reply #28 on: December 31, 2009, 10:49:21 AM »
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.


Code: [Select]
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>
';
« Last Edit: December 31, 2009, 10:55:22 AM by freddy888 »

prometheus fire

  • Guest
Re: [Block] Recent topics with hover over previews.
« Reply #29 on: December 31, 2009, 02: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)
« Last Edit: December 31, 2009, 03:12:24 PM by prometheus fire »