|
Page 1 of 2
|
Chaotic 
Joined: January 2008
Posts: 1369
Location:  Georgia
|
 First & Last Post Hover Preview
Has anyone seen this?
http://www.phpbb.com/community/viewtopic.php?f=16&t=578679
Look at how awesome it is. First and last post previews when hovering over a topic title. It even shows BBCodes in the preview.
After just making the changes in viewforum.php, I get this error:
Fatal error: Call to undefined function bbencode_second_pass() in /homepages/33/d163845182/htdocs/macommunity_root/macommunity_site/viewforum.php on line 1307
This is my line 1307:
$first_post = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($first_post, $first_post_bbcode_uid) : preg_replace('/:[0-9a-z:]+]/si', ']', $first_post);
Any idea what is going on?
Here is the mod:
Description: |
Hover Preview |
 Download |
Filename: |
onmouse_display_first&last_post_preview.zip |
Filesize: |
15.34 KB |
Downloaded: |
220 Time(s) |
____________ | Icy Phoenix ColorizeIt! |
Bipolar Disorder - Not good for you and definitely not good for everyone else.
|
Share |
#1 Tue 06 Jan, 2009 03:09 |
|
Sponsors

|
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.
|
|
Inactive User
|
 Re: First & Last Post Hover Preview
Those strings are no good because IP uses $bbcode to parse the params. And that would mean removing those strings and editing the body of the script and changing / modifying the variables for it to work.
If first and last post is not optional for one or the other etc - Post's Viewed is going to suffer something awful.
There is also another phpBB2 mod that shows the images in Mouse-Hover - can't remember exactly what it did - Didn't like it.
Edit: 40 minutes of my life wasted.
However! This is the first sample (Not much markup) which still needs a lot of scrap removed from the code and the instructions re-written when I dig it out the changes.
And seriously, the MOD does need a lot of cleaning up to make it a whole lot better using IP params.
Will catch up tomorrow.
Edited by Guest, Tue 06 Jan, 2009 10:38: 40 minutes of my life wasted! hehehe! |
Share |
#2 Tue 06 Jan, 2009 08:13 |
|
Chaotic 
Joined: January 2008
Posts: 1369
Location:  Georgia
|
 Re: First & Last Post Hover Preview
Yeah, I thought it would be kind of crazy.
It looks like the best hover preview I've ever seen and it would be a shame for there to be no way it could work with IP. I've seen it on plenty of sites and it's been bugging me for months.
____________ | Icy Phoenix ColorizeIt! |
Bipolar Disorder - Not good for you and definitely not good for everyone else.
|
Share |
#3 Tue 06 Jan, 2009 17:35 |
|
Inactive User
|
 Re: First & Last Post Hover Preview
Update!
It's 6am
If I clean up the first sheet a little later on, and paste it here. Do you want to go on with modifying the rest of it - Or do you want me to do it.
It probably only needs one "Instruction" sheet, "File" the .js and add 1 to 4 template options (or 10 - or 20 LOL!) or just make a default template etc.
Either way I'll post something you can play with soon.!
Edit:
Well Mate, I think I've got it right - but this MOD needs lang and template variables added to make it theme compatible and compliant with languages and IP. I mean who wants to edit viewforum.php to change the lang or style?
I already have a mouse-over hover MOD, and I'm not really interested in the "Last Post" thing - so this is probably as far as I'll be going with it.
Install_onmouse_over_topic_title_En.txt.
Updated with Compliant html, .css .js and Language Vars.
Still working on the Hide function.
Package Icy Phoenix Modifications
File $Id: install_onmouse_over_topic_title_En.txt
Version for Icy Phoenix: 0.0.1
Author: ShadowKnyght < forum@cyber-mag.com > (James B) h**p://forum.cyber-mag.com
Original Author: emrag < emrah987@hotmail.com > (Emrah Türkmen) ***.canver.net (TURKEY)
Copyright: (c) 2004 Emrah Türkmen
Email: < forum@cyber-mag.com > < emrah987@hotmail.com >
License h**p://opensource.org/licenses/GPL-license.php GNU Public License
Extra credits for this file:
Modified for Icy Phoenix by Lopalong. < lopalong@iinet.net.au > 07 January 2009
Title:
Onmouse Over Topic Title Display First And Last Post
Description:
When you hover the mouse on a topic link you will see first and
last posted message as a hover title like vBulletin
Files To Edit: 3
viewforum.php
templates/mg_themes/viewforum_body.tpl
languages/lang_english/lang_extend_icy_phoenix.php
Included Files: None
Disclaimer:
There is no guarantee that there are no security problems within the MOD.
Comments:
Author Notes:
The javascript added to viewforum_body.tpl comes from Mojavlinux's MyCalendar 2.2.6
( h**p://***.mojavelinux.com/ )
WARNING - WARNING - WARNING:
Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#
#-----[ BEGIN MODIFICATION ]------------------------------------------
#
#
#-----[ OPEN ]------------------------------------------
#
viewforum.php
#
#----[ FIND ]------------------------------------------
#
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
// START Onmouse Over Topic Title Display First And Last Post
// display first message as title
// character limit for hover title
$chr_limit = '350';
$first_post = '<div class="roundedhc" style="height:18px; padding: 2px 0 2px 0; font-weight:bold;"> ' . $lang['Firstpost'] . '</div><br />';
$sql = "SELECT p.*, pt.post_text, pt.post_id, pt.bbcode_uid
FROM " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt
WHERE p.topic_id = $topic_id
AND pt.post_id = p.post_id
ORDER BY p.post_time
LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Cannot obtain topic information', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$post_test = $row['post_text'];
$first_post .= $row['post_text'];
// if message is longer than character limit break message
// and add "......More" at the last of message
if (strlen($first_post) > $chr_limit)
{
$first_post = substr($first_post, 0, $chr_limit);
$first_post .= '<span class="genmed" style="font-weight:bold;">' . $lang['More'] . '</span>';
}
// If the board has HTML off but the post has HTML
// on then we process it, else leave it alone
if ( !$board_config['allow_html'] )
{
if ( $row['enable_html'] )
{
$first_message = preg_replace('#(<)([/]?.*?)(>)#is', "<
$first_message = preg_replace('#(<)([/]?.*?)(>)#is', "<\2>", $first_post);
<>", $first_post);
}
}
// Parse message for BBCode if required
if ( $board_config['allow_bbcode'] )
{
$first_post = $bbcode->parse( $board_config['allow_bbcode'] ) ? ($first_post) : preg_replace('/:[0-9a-z:]+]/si', ']', $first_post);
}
// Parse smilies
if ( $board_config['allow_smilies'] )
{
if ( $row['enable_smilies'] )
{
$first_post = $bbcode->parse($first_post);
}
}
// replace n with <Nothing>
$first_post = preg_replace("/[nr]{1,2}/", '', $first_post);
// escape from double and/or single quotes
$first_post = str_replace(array('"', '''), array('"', '\''), $first_post);
// if message have [hide] [/hide] tags
// there will be an error message instead of normal message
if ( preg_match("/[hide]/i", $first_post) && preg_match("/[/hide]/i", $first_post))
{
$first_post = '<div class="gen">' . $lang['Protected'] . '</div>';
}
// display first message as title
// Add last post to pop up text
$char_limit = '350';
$last_post = '<hr /><div class="roundedhc" style="height:18px; padding: 2px 0 2px 0; font-weight:bold;"> ' . $lang['Lastpost'] . '</div><br />';
$sql = "SELECT *, post_text, post_id, bbcode_uid
FROM " . POSTS_TEXT_TABLE . "
WHERE post_id=" . $topic_rowset[$i]['topic_last_post_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Cannot obtain topic information', '', __LINE__, __FILE__, $sql);
}
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$post2_test = $row['post_text'];
$last_post .= $row['post_text'];
if (strlen($last_post) > $char_limit)
{
$last_post=substr($last_post, 0, $char_limit) . '<span class="genmed" style="font-weight:bold;">' . $lang['More'] . '</span>';
}
// If the board has HTML off but the post has HTML
// on then we process it, else leave it alone
if ( !$board_config['allow_html'] )
{
if ( $row['enable_html'] )
{
$last_message = preg_replace('#(<)([/]?.*?)(>)#is', "<
$last_message = preg_replace('#(<)([/]?.*?)(>)#is', "<\2>", $last_post);
<>", $last_post);
}
}
// Parse message for BBCode if required
if ( $board_config['allow_bbcode'] )
{
$last_post = $bbcode->parse( $board_config['allow_bbcode'] ) ? ($last_post) : preg_replace('/:[0-9a-z:]+]/si', ']', $last_post);
}
// Parse smilies
$last_post = $bbcode->parse($last_post);
// replace n with <Nothing>
$last_post = preg_replace("/[nr]{1,2}/", '', $last_post);
// escape from double and/or single quotes
$last_post = str_replace(array('"', '''), array('"', '\''), $last_post);
// if message has [hide] [/hide] tags
// there will be an error message instead of normal message
if ( preg_match("/[hide]/i", $last_post) && preg_match("/[/hide]/i", $last_post))
{
$last_post = '<div class="gen">' . $lang['Protected'] . '</div>';
}
// Join first and last post text
if (!($post_test == $post2_test))
{
$first_post .= $last_post;
}
// END Adding last post to pop up text
// END Onmouse Over Topic Title Display First And Last Post
#
#----[ FIND ]------------------------------------------
#
'TOPIC_FOLDER_IMG' => $topic_link['image'],
'L_TOPIC_FOLDER_ALT' => $topic_link['image_alt'],
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// START Onmouse Over Topic Title Display First And Last Post
'FIRST_POST' => $first_post,
// END Onmouse Over Topic Title Display First And Last Post
#
#-----[ OPEN ]------------------------------------------
#
templates/mg_themes/viewforum_body.tpl
#
#----[ FIND ]------------------------------------------
#
<div class="forumline nav-div">
<p class="nav-header">
#
#----[ BEFORE, ADD ]------------------------------------------
#
<!-- Onmouse Over Topic Title Display First And Last Post START -->
<!-- The javascript presents here comes from MyCalendar 2.2.6 from MojavLinux Modified further by ShadowKnyght -->
<script language="Javascript" type="text/javascript">
<!--
var agt = navigator.userAgent.toLowerCase();
var originalFirstChild;
function createTitle(which, string, x, y)
{
// record the original first child (protection when deleting)
if (typeof(originalFirstChild) == 'undefined')
{
originalFirstChild = document.body.firstChild;
}
x = document.all ? (event.clientX + document.body.scrollLeft) : x;
y = document.all ? (event.clientY + document.body.scrollTop) : y;
element = document.createElement('div');
element.style.position = 'absolute';
element.style.zIndex = 1000;
element.style.visibility = 'hidden';
excessWidth = 0;
if (document.all)
{
excessWidth = 50;
}
excessHeight = 20;
element.innerHTML = '<div class="row2g-left-top"><table width="350" cellspacing="0" cellpadding="3" border="2"><tr><td><table width="100%" class="row2g-left-top" cellspacing="0" cellpadding="4"><tr><td><span class="genmed">' + string + '</span></td></tr></table></td></tr></table></div>';
renderedElement = document.body.insertBefore(element, document.body.firstChild);
renderedWidth = renderedElement.offsetWidth;
renderedHeight = renderedElement.offsetHeight;
// fix overflowing off the right side of the screen
overFlowX = x + renderedWidth + excessWidth - document.body.offsetWidth;
x = overFlowX > 0 ? x - overFlowX : x;
// fix overflowing off the bottom of the screen
overFlowY = y + renderedHeight + excessHeight - window.innerHeight - window.pageYOffset;
y = overFlowY > 0 ? y - overFlowY : y;
renderedElement.style.top = (y + 15) + 'px';
renderedElement.style.left = (x + 15) + 'px';
// windows versions of mozilla are like too fast here...we have to slow it down
if (agt.indexOf('gecko') != -1 && agt.indexOf('win') != -1)
{
setTimeout("renderedElement.style.visibility = 'visible'", 1);
}
else
{
renderedElement.style.visibility = 'visible';
}
}
function destroyTitle()
{
// make sure we don't delete the actual page contents (javascript can get out of alignment)
if (document.body.firstChild != originalFirstChild)
{
document.body.removeChild(document.body.firstChild);
}
}
//-->
</script>
<!-- Onmouse Over Topic Title Display First And Last Post END -->
#
#----[ FIND ]------------------------------------------
#
{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_ATTACHMENT_IMG}{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" class="{topicrow.TOPIC_CLASS}">{topicrow.TOPIC_TITLE}</a>{topicrow.CALENDAR_TITLE}
#
#----[ INLINE FIND ]------------------------------------------
#
class="{topicrow.TOPIC_CLASS}"
#
#----[ INLINE AFTER, ADD ]---------[ AND Include The Leading Space ]---------------------------------
#
onmouseover="createTitle(this, '{topicrow.FIRST_POST}', event.pageX, event.pageY);" onmouseout="destroyTitle();"
#
#-----[ OPEN ]------------------------------------------
#
languages/lang_english/lang_extend_icy_phoenix.php
#
#----[ FIND ]------------------------------------------
#
//$lang[''] = '';
#
#----[ BEFORE, ADD ]------------------------------------------
#
// START Onmouse Over Topic Title Display First And Last Post
$lang['Firstpost'] = 'First Post';
$lang['Lastpost'] = 'Last Post';
$lang['More'] = ' ......More';
$lang['Protected'] = '<b>Protected message:</b><br />If you are a <b>*registered user*</b> :<br />you must post a reply to this topic to see the message ';
// END Onmouse Over Topic Title Display First And Last Post
#
#-----[ SAVE ALL FILES/CLOSE ]------------------------------------------
#
Edited by Guest, Wed 07 Jan, 2009 15:05: Added upgraded Script |
Share |
#4 Tue 06 Jan, 2009 21:21 |
|
Chaotic 
Joined: January 2008
Posts: 1369
Location:  Georgia
|
 Re: First & Last Post Hover Preview
Great work TDU.
I followed the Install Style 1 instructions and this is what I see:
There isn't a background for the pop-up. How did you do that here?
I hear you about having to go back and change stuff in viewforum.php all the time if you used different styles and such. I know how to tweak things here and there, but adding lang and style variables is a little too much for me right now, LOL. I just don't understand how and where you added a background to the pop-up, LOL.
Again, great job!
____________ | Icy Phoenix ColorizeIt! |
Bipolar Disorder - Not good for you and definitely not good for everyone else.
|
Share |
#5 Wed 07 Jan, 2009 00:30 |
|
Inactive User
|
 Re: First & Last Post Hover Preview
It would be a safe bet that something is either missing from the .css of there is a javascript conflict.
Try it with a different theme. ?
Also, you could change the markup in the viewforum.php script (For $first and $last post to <div class=" - id= - whatever, then it should use the .css for the template.
Or you could also use <div style=" etc.
|
Share |
#6 Wed 07 Jan, 2009 02:41 |
|
Chaotic 
Joined: January 2008
Posts: 1369
Location:  Georgia
|
 Re: First & Last Post Hover Preview
Limun and I worked that part out.
What say you about this? (Notice the huge gaps in preview, but no huge gaps exist in the actual post....)
____________ | Icy Phoenix ColorizeIt! |
Bipolar Disorder - Not good for you and definitely not good for everyone else.
|
Share |
#7 Wed 07 Jan, 2009 03:08 |
|
Inactive User
|
 Re: First & Last Post Hover Preview
When you choose to make changes "underground" and not post what you have changed, be it the MOD or the style.
Further questions become quite pointless.
|
Share |
#8 Wed 07 Jan, 2009 06:59 |
|
Chaotic 
Joined: January 2008
Posts: 1369
Location:  Georgia
|
 Re: First & Last Post Hover Preview
Here is the "underground" code addition. Don't tell anyone!
Added this at the bottom of the style_?.css
.bodyline {
/*background-color: #ffffff;*/
background: #FFFFFF url('images/mech/bg_post.gif') repeat-x;
border: solid 2px #333333;
}
____________ | Icy Phoenix ColorizeIt! |
Bipolar Disorder - Not good for you and definitely not good for everyone else.
|
Share |
#9 Wed 07 Jan, 2009 07:31 |
|
Inactive User
|
 Re: First & Last Post Hover Preview
Thank you Chaotic for the delayed information.
The Lecture:
Sigh!!
It is far wiser to change modifications to suit Icy Phoenix rather than vice-versa. There are are plenty of classes and id's to use in the .css, or one could also use the style function. Rather than stuffing around adding extra classes that would need to be added to every other different style.css.
Anyway, the script in the post I did has been upgraded. If you copy only the large part of viewforum.php; you should be good to go.
Thank you for your Beta-Testing.
xxxxxx Yeah!
|
Share |
#10 Wed 07 Jan, 2009 08:53 |
|
Chaotic 
Joined: January 2008
Posts: 1369
Location:  Georgia
|
 Re: First & Last Post Hover Preview
That's right! xxxxxxx yeah!
Works like a brand new liver.
____________ | Icy Phoenix ColorizeIt! |
Bipolar Disorder - Not good for you and definitely not good for everyone else.
|
Share |
#11 Wed 07 Jan, 2009 09:16 |
|
Inactive User
|
 Re: First & Last Post Hover Preview
ROFL - LMAO!
Put with you have at the moment, and I'll have a look at making it integrated with IP .css etc, etc. After all we've come this far so it may as well be finished properly.
And what's another 100 minutes of my life wasted between friends.
|
Share |
#12 Wed 07 Jan, 2009 09:26 |
|
Chaotic 
Joined: January 2008
Posts: 1369
Location:  Georgia
|
 Re: First & Last Post Hover Preview
Do you want me to post my whole viewforum.php and viewforum_body.tpl?
____________ | Icy Phoenix ColorizeIt! |
Bipolar Disorder - Not good for you and definitely not good for everyone else.
|
Share |
#13 Wed 07 Jan, 2009 09:38 |
|
Inactive User
|
 Re: First & Last Post Hover Preview
What do I need that for?
|
Share |
#14 Wed 07 Jan, 2009 09:47 |
|
Chaotic 
Joined: January 2008
Posts: 1369
Location:  Georgia
|
 Re: First & Last Post Hover Preview
Put with you have at the moment, and I'll have a look at making it integrated with IP .css etc, etc.
Oops. That must be the Aussie English coming out.
My bad!
____________ | Icy Phoenix ColorizeIt! |
Bipolar Disorder - Not good for you and definitely not good for everyone else.
|
Share |
#15 Wed 07 Jan, 2009 10:09 |
|
|
Page 1 of 2
|
Was this topic useful?
Was this topic useful?
Link this topic |
URL |
|
BBCode |
|
HTML |
|
You cannot post new topics You cannot reply to topics You cannot edit your posts You cannot delete your posts You cannot vote in polls You cannot attach files You can download files You cannot post calendar events
|
|
|
|