TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

May 04, 2024, 07:18:41 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,178
  • Total Topics: 21,220
  • Online today: 77
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 59
  • Total: 59

[Discussion] Recent topics table with hover over previews.

Started by alhaudhie, September 14, 2009, 04:58:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

alhaudhie

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.

Freddy

Try changing this line :

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

To this :

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

alhaudhie


alhaudhie

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?

Freddy

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

no problem at all..

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

prometheus fire

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

}


Freddy


Freddy

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

prometheus fire

#29
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)