• Welcome to Simple Machines Community Forum. Please login or sign up.
January 19, 2022, 04:08:18 AM

News:

Want to get involved in developing SMF, then why not lend a hand on our github!


MouseOver: topic preview!

Started by A.M.A, October 15, 2004, 02:33:24 PM

Previous topic - Next topic

A.M.A

October 15, 2004, 02:33:24 PM Last Edit: August 02, 2006, 12:18:36 AM by Jay The Code Monkey
Notice:
This tip has been in some way ported over to be a modification package located on the SMF modsite. Please note, the mod package may not do the exact same function and may not even use any of the code originally written for the tip, but should still hold the same basic functionality of the tip posted here. With the mod package for this tip, you can now let the SMF package manager make the code changes for you without you having to look at the code and edit it manually.

For documentation on using the SMF package manager, view this document.

To download the modification package, [please click here].




In MessageIndex.template.php find:

', $topic['first_post']['link'];

Replace:

<span title="', $topic['first_post']['preview'], '">', $topic['first_post']['link'], '</span>';

You must have 1.0 RC1 or higher to do this.

By: [Unknown]
Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

Winters

October 15, 2004, 03:22:57 PM #1 Last Edit: October 16, 2004, 01:33:39 PM by Winters
Sigh, I seem to be bad with applying mods these days...

But, the good thing first: It does tool tips, and I've wanted this feature for a long time, so thanks!

The only thing is, they don't start from the beginning of a post, it swallows letters/ words/ the first post, is that intentional or did I do something wrong?? Oh, and also they show html entities in between.   

Here's a link to check for yourselves: 
(Link removed, solved)

codenaught

I have the same problem. The beginning of it isn't displayed.

What I noticed is that it will display the start of the second line. So when there is just one line it will display fine but when there are more then one it seems to show the start of the second line.
Dev Consultant
Former SMF Doc Coordinator

[Unknown]

Bloody.... grr... find, MessageIndex.php:

$row['firstBody'] = substr($row['firstBody'], 128) . '...';
$row['lastBody'] = strip_tags(strtr(doUBBC($row['lastBody'], $row['lastSmileys']), array('<br />' => '&#10;')));
if (strlen($row['lastBody']) > 128)
$row['lastBody'] = substr($row['lastBody'], 128) . '...';


Replace:

$row['firstBody'] = substr($row['firstBody'], 0, 128) . '...';
$row['lastBody'] = strip_tags(strtr(doUBBC($row['lastBody'], $row['lastSmileys']), array('<br />' => '&#10;')));
if (strlen($row['lastBody']) > 128)
$row['lastBody'] = substr($row['lastBody'], 0, 128) . '...';


Will be resolved in the next release.

-[Unknown]

codenaught

Thank you very much. That did it. Great mod, I like it a lot.  :)
Dev Consultant
Former SMF Doc Coordinator

CarLBanks

I did this and nothing shows up.

dg

Quote from: [Unknown] on October 15, 2004, 03:55:32 PM
Bloody.... grr... find, MessageIndex.php:

$row['firstBody'] = substr($row['firstBody'], 128) . '...';
$row['lastBody'] = strip_tags(strtr(doUBBC($row['lastBody'], $row['lastSmileys']), array('<br />' => '&#10;')));
if (strlen($row['lastBody']) > 128)
$row['lastBody'] = substr($row['lastBody'], 128) . '...';


Replace:

$row['firstBody'] = substr($row['firstBody'], 0, 128) . '...';
$row['lastBody'] = strip_tags(strtr(doUBBC($row['lastBody'], $row['lastSmileys']), array('<br />' => '&#10;')));
if (strlen($row['lastBody']) > 128)
$row['lastBody'] = substr($row['lastBody'], 0, 128) . '...';


Will be resolved in the next release.

-[Unknown]

I'm using RC1 and I couldn't find that code in MessageIndex.php???

[Unknown]

It's not in RC1.  I never said this would work properly/well in RC1.

-[Unknown]

dg

Quote from: [Unknown] on October 18, 2004, 12:28:32 AM
It's not in RC1.  I never said this would work properly/well in RC1.

-[Unknown]

Gotcha...just confused from the first post ;D

[Unknown]

Well, no, the mod will work... just not that part of it exactly :P.

-[Unknown]

dg

Quote from: dg on October 18, 2004, 12:17:29 AM
Quote from: [Unknown] on October 15, 2004, 03:55:32 PM
Bloody.... grr... find, MessageIndex.php:

$row['firstBody'] = substr($row['firstBody'], 128) . '...';
$row['lastBody'] = strip_tags(strtr(doUBBC($row['lastBody'], $row['lastSmileys']), array('<br />' => '&#10;')));
if (strlen($row['lastBody']) > 128)
$row['lastBody'] = substr($row['lastBody'], 128) . '...';


Replace:

$row['firstBody'] = substr($row['firstBody'], 0, 128) . '...';
$row['lastBody'] = strip_tags(strtr(doUBBC($row['lastBody'], $row['lastSmileys']), array('<br />' => '&#10;')));
if (strlen($row['lastBody']) > 128)
$row['lastBody'] = substr($row['lastBody'], 0, 128) . '...';


Will be resolved in the next release.

-[Unknown]

I'm using RC1 and I couldn't find that code in MessageIndex.php???

great huge quote....anyway

I'm now using RC2 and still can't find it!

[Unknown]

Did you install the fix via the package manager?

-[Unknown]

dg

Quote from: [Unknown] on October 20, 2004, 12:09:32 AM
Did you install the fix via the package manager?

-[Unknown]

No, I just edited the file with EditPlus...I found the first part (the $topic change) no problem, it's the second part (the $row) that I can't even find in MessageIndex.php

A.M.A

It is two lines below this:
// Limit them to 128 characters - do this FIRST because it's a lot of wasted censoring otherwise.
Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

Kindred

And in combination with the bold (sticky) / italics (locked) mods, the line would look like this:

                        <span style="', $topic['is_sticky'] ? 'font-weight: bold;' : '', $topic['is_locked'] ? 'font-style: italic;' : '', '" title="', $topic['first_post']['preview'], '">
                                ', $topic['is_sticky'] ? 'Sticky: ' : ($topic['is_locked'] ? 'Locked: ' : ''), ' ', $topic['first_post']['link'], '
                        </span>';
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

soapbath

This don't work in classic template :( And I can't seem to get it to work it in.. would there be a code for classic template?

soapbath


Jerry

yes it would be in the classic template files instead of default Themes folder.


- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

Oldiesmann

I wish I had thought about that when someone asked me to do this. I did it by adding the title to the first post link in MessageIndex.php. Works just as well either way though.
Michael Eshom
Cincy Space - now open!

spiros

January 17, 2005, 08:36:11 AM #19 Last Edit: January 17, 2005, 08:39:28 AM by spiros
I have applied this change but nothing happened. I have also tried to find

', $topic['first_post']['link'];

but the most relevant string I found was

$started = $topic['first_post']['member']['id'] == $ID_MEMBER;

I am using SMF 1.0, default template

Quote from: [Unknown] on October 15, 2004, 03:55:32 PM
Bloody.... grr... find, MessageIndex.php:

$row['firstBody'] = substr($row['firstBody'], 128) . '...';
$row['lastBody'] = strip_tags(strtr(doUBBC($row['lastBody'], $row['lastSmileys']), array('<br />' => '&#10;')));
if (strlen($row['lastBody']) > 128)
$row['lastBody'] = substr($row['lastBody'], 128) . '...';


Replace:

$row['firstBody'] = substr($row['firstBody'], 0, 128) . '...';
$row['lastBody'] = strip_tags(strtr(doUBBC($row['lastBody'], $row['lastSmileys']), array('<br />' => '&#10;')));
if (strlen($row['lastBody']) > 128)
$row['lastBody'] = substr($row['lastBody'], 0, 128) . '...';


Will be resolved in the next release.

-[Unknown]

Advertisement: