TinyPortal

Development => Block Codes => Topic started by: prometheus fire on January 03, 2010, 02:09:26 AM

Title: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: prometheus fire on January 03, 2010, 02:09:26 AM
Edit by freddy888 :   Click here to get the code (http://www.tinyportal.net/index.php?topic=31643).



Note: this is a split topic and a modification of the block code found at http://www.tinyportal.net/index.php?topic=31632

The changes discussed here are to display a scrolling recent TOPICS block; the other block thread is for displaying a scrolling recent POSTS block.



Hmmmm....it wasn't obvious at first but the only issue I've noticed is that busy topics show up more than once in the list.

The way it fetching the information means that a hotter topics show up everytime they get a post. Instead of showing the 10 most recent topics it is showing the 10 most recent posts. This makes a lot of repitition in the list. I'm looking at the original block that you made with MRCare and the differences are obvious but its not clear what to adjust since the code being used now is from SSI.php is a drastically different from what what used before.
Title: Re: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: prometheus fire on January 03, 2010, 02:41:50 AM
I went back into SSI.php to have a look at the code you pulled out (great job editing it down, because there is a lot that you streamlined).

I noticed that there are two "recent" sections. One for posts and one for topics. Here is the comments for each section:

For recent posts (this is the one currently used causing the repetition in the list)
// Recent post list:   [board] Subject by Poster Date
function ssi_recentPosts($num_recent = 8, $exclude_boards = null, $output_method = 'echo')


and, for recent topics:
// Recent topic list:   [board] Subject by Poster Date
function ssi_recentTopics($num_recent = 8, $exclude_boards = null, $output_method = 'echo')


Now - looking into each section individually, in the db_query section there are very minor differences in there that I'm not sure how to use. I know something in the latter, topics, section needs to be used, but I'm not sure what.

This may also effect the recent non-scrolling version of this block script you posted.
Title: Re: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: Freddy on January 03, 2010, 03:08:17 AM
Ok thanks, well at least we are getting somewhere :)

I will look into that, I know exactly what you mean - I think it would be better if it just worked the way the regular TP recent posts work - ie, with just the one entry like you were explaining.

Leave it with me for a bit longer - I can always post two versions of the code.
Title: Re: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: Freddy on January 03, 2010, 03:15:45 AM
Yes - it seems I got my topics and my posts mixed up when I was looking at SSI.php

I'll just amend the threads I have posted before I do anything else.
Title: Re: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: prometheus fire on January 03, 2010, 03:21:54 AM
OKay, I managed to fix the repetition problem, I pulled the code from the "recent topics" section of SSI.php (this is the latter section that I listed above)

So, for this code block, we should:

Find:
// Find all the posts.  Newer ones will have higher IDs.
// This is stripped down from SSI.php

$request = db_query("
SELECT
m.subject, m.ID_TOPIC, m.ID_MSG,
LEFT(m.body, ". (!empty($modSettings['NiceTooltips_lenght']) ? $modSettings['NiceTooltips_lenght'] : 384) .") AS body
FROM ({$db_prefix}messages AS m, {$db_prefix}boards AS b)
WHERE m.ID_MSG >= " . ($modSettings['maxMsgID'] - 25 * min($num_recent, 5)) . "
AND b.ID_BOARD = m.ID_BOARD" . (empty($exclude) ? '' : "
AND b.ID_BOARD NOT IN (" . implode(', ', $exclude) . ")") . "
AND $user_info[query_see_board]
ORDER BY m.ID_MSG DESC
LIMIT $num_recent", __FILE__, __LINE__);


and, Replace with:
// Find all the posts in distinct topics.  Newer ones will have higher IDs.
// This is stripped down from SSI.php

$request = db_query("
SELECT
m.subject, m.ID_TOPIC, m.ID_MSG,
LEFT(m.body, ". (!empty($modSettings['NiceTooltips_lenght']) ? $modSettings['NiceTooltips_lenght'] : 384) .") AS body
FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ms)
WHERE t.ID_LAST_MSG >= " . ($modSettings['maxMsgID'] - 25 * min($num_recent, 5)) . "
AND t.ID_LAST_MSG = m.ID_MSG
AND b.ID_BOARD = t.ID_BOARD" . (empty($exclude) ? '' : "
AND b.ID_BOARD NOT IN (" . implode(', ', $exclude) . ")") . "
AND $user_info[query_see_board]
AND ms.ID_MSG = t.ID_FIRST_MSG
ORDER BY t.ID_LAST_MSG DESC
LIMIT $num_recent", __FILE__, __LINE__);


The only problem to smooth out is to force the display (is this the array section of your code?) to display the topic name not the message name/subject as it currently does. Instead of:

Jimmy's new trucks it is showing Re: Jimmy's new trucks

This is because we are having it display the topics based on the most recent message so it is displaying the subject for that message. What would be cleaner is to have it display the topic name while still showing the most recent message in the popup (I believe this how your original code for this block worked).

UPDATE: I tried a number of things to remove the Re: and to display the topic name but I can't figure it out. I just don't understand enough about dbase queries and php. It looks like we are requesting all the info from the dbase, but I don't get what we need to do to output the relevant pieces.
Title: Re: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: Freddy on January 03, 2010, 03:29:45 AM
Yes I see what you mean... hmm I think I need a coffee.  I will pick up where you left off when I get back.

BTW, I split this thread off into one about the TOPICS version.... as that is what we are working on.

Silly me, for picking the wrong function, but hey we get four new blocks instead of two eventually.
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: Freddy on January 03, 2010, 04:03:54 AM
Try changing the query to this :

$request = db_query("
SELECT
ms.subject, m.ID_TOPIC, m.ID_MSG,
LEFT(m.body, ". (!empty($modSettings['NiceTooltips_lenght']) ? $modSettings['NiceTooltips_lenght'] : 384) .") AS body
FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ms)
WHERE t.ID_LAST_MSG >= " . ($modSettings['maxMsgID'] - 35 * min($num_recent, 5)) . "
AND t.ID_LAST_MSG = m.ID_MSG
AND b.ID_BOARD = t.ID_BOARD" . (empty($exclude_boards) ? '' : "
AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "
AND $user_info[query_see_board]
AND ms.ID_MSG = t.ID_FIRST_MSG
ORDER BY t.ID_LAST_MSG DESC
LIMIT $num_recent", __FILE__, __LINE__);


You needed to use ms.subject rather than m.subject at the top....

It seems to be working okay here.

If that all works and you can confirm it I will post it as a new block and link back to this thread.

Thanks for putting that note at the top :)
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: prometheus fire on January 03, 2010, 04:20:14 PM
confirmed. that's great work. looks like we can consider this one complete. thanks for that work and your knowledge.

anyone wanting to see this working can see it at http://leafboxtea.com
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: Freddy on January 03, 2010, 05:09:37 PM
Thanks and you are welcome :)

For anyone who missed it : Click here to get the code (http://www.tinyportal.net/index.php?topic=31643).

We just need the mod maker to work on that BBC bug.
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: Freddy on January 03, 2010, 05:42:00 PM
Just to be going on with.  If you want to block out chopped urls then try this out :

Before :

// Generate the pop up...
$popup = NiceTooltip($w['preview'], $w['subject']);


Add :    

// Quick fix for chopped urls...
$bad_url = strpos($w['preview'],'[url=');

if ($bad_url)
$w['preview'] = substr($w['preview'], 0, $bad_url);


It's only rough and ready but that should get most of them I think.  I can't figure out a simple way to check for broken bbc code, I would rather let the mod maker work on that bug.
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: prometheus fire on May 23, 2010, 12:24:44 AM
Looking to create another small feature for this block. I just created a new board on my forum that I don't want feed into this display. 

In this instance it is board number 16 (this value with vary between users); I've been scanning the code trying to figure how and where to put the board value - so far I've only managed to break it. Any ideas?
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: Freddy on May 23, 2010, 01:25:29 PM
So you want to block boards on a per member group basis ?

Eg

if they are in member group 1 then block board x

if they are in member group 3 then block board y

etc etc

What version of SMF are you on now ?

Also, are the member groups you want to use specific member groups or post count member groups ?  Or even both ?
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: insanemustang on January 25, 2011, 03:16:29 PM
I'm interested in getting this block, but instead of scrolling vertically, I'd like to see it scroll horizontal.

Any chance of that?
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: Freddy on January 25, 2011, 04:14:23 PM
You will need to edit the marque effect in the code.

Here's a page explaining what you can do with marquees.  Pretty simple stuff as HTML goes.

http://www.quackit.com/html/codes/html_marquee_code.cfm

Let us know if you need a hand.
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: insanemustang on January 26, 2011, 03:46:18 AM
Thank you Freddy, going to give this a look tomorrow (if it snows me in from work  :2funny:)

Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: insanemustang on January 28, 2011, 12:47:44 AM
Um, yea... so I gave it a look, and I have no idea where to start or end.  Assistance would be great.
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: ZarPrime on January 28, 2011, 01:22:30 AM
insanemustang,

This is Freddy's code but I'm guessing that, if you want to change the marquee behavior, you'll need to edit the code here ...

// Output the topics

echo '
<marquee  behavior="scroll" direction="up" height="150px" scrolldelay="1" scrollamount=" 1" onmouseover="this.stop()" onmouseout="this.start()">';


I'm guessing that Probably changing the direction from "up" to "left" or "right" wil change the direction from vertical to horizontal.

ZarPrime
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: agent47 on January 28, 2011, 12:33:43 PM
If you look at my site (http://www.superheroalliance.net/index.php) you'll see that at one point the width of a topic name seems to get thicker due to the date. So what I was thinking was to remove icons to make room for the AM/PM in the "Date and Time" array. I seem to be a noob at this as everytime i remove some line related to the icons I seem to break something. Was wondering if someone will be generous enough to remove the icon array or rather point out the lines that I have to remove.

Basically I just need to know the lines that need to be removed in order to remove the icon array to make room so that the AM/PM don't fall onto the next line
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: ZarPrime on January 28, 2011, 03:15:15 PM
agent47,

Please understand that none of us here on the TinyPortal Team are  a member of the Internet Police, if there is such a thing.  However, that being said, our rules here are pretty specific on when we will provide to someone who is breaking the rules, as we see them.  You are probably wondering what I am talking about.  Let me explain.  You are using a theme from dzinerstudio on your site and the theme author's copyright has been removed from your site in violation of their Terms of Use.  Specifically, on the page http://www.dzinerstudio.com/index.php?action=terms, it states that "It's not permitted to remove our copyright information from the footer. You are however allowed to add your own name onto our copyright (i.e. "Design by DzinerStudio / Modified by your name")."

Secondlly,  I looked at your site as a Guest and I can't see the block you are posting about in this topic.  Please enable the block so that Guests can view it so that we can see the issue you are posting about or at least post a screenshot showing the behavior.  But please, fix the issue discussed in my paragraph above first so that we can at least feel good about trying to help you.

ZarPrime
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: insanemustang on January 28, 2011, 05:06:51 PM
Quote from: ZarPrime on January 28, 2011, 01:22:30 AM
insanemustang,

This is Freddy's code but I'm guessing that, if you want to change the marquee behavior, you'll need to edit the code here ...

// Output the topics

echo '
<marquee  behavior="scroll" direction="up" height="150px" scrolldelay="1" scrollamount=" 1" onmouseover="this.stop()" onmouseout="this.start()">';


I'm guessing that Probably changing the direction from "up" to "left" or "right" wil change the direction from vertical to horizontal.

ZarPrime

I isntalled the NiceToolTips mod and then I put the original code into a PHP block to be sure I could get it to scroll at all.  It won't scroll up.  Until I can figure out why not, I can't worry about changing the direction.
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: agent47 on January 28, 2011, 08:31:20 PM
Hey Zarprime,
What I am about to say may seem unbelievable but I'm going to say it anyways. Honestly and I'm not proud to say it but I didn't buy this theme but it was shared by a friend of mine so he possibly removed it. If you look at my site you'll notice that the rest of copyright links exist which means I have no reason at all to remove JUST the Dziner Studio copyright link. Like I said you may not believe me but I just had to say it. Anyways I'm trying to add Dziner Studios link as we speak.
And about the recent topics, my apologies I didn't know this was a separate mod with the marquee. I thought this was the same, basic version of the mod which is recent topics with hover over previews. Anyways still think you can help me out with removing the icon array?

EDIT: Nevermind. Managed to fix it without breaking anything else. :)
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: agent47 on January 28, 2011, 08:31:40 PM
Arggh. Sorry.
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: insanemustang on January 30, 2011, 01:01:42 AM
Can anyone help me with my request?
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: Freddy on January 30, 2011, 02:21:32 PM
Hi mustang,

Can you tell me what version of SMF you are on, I'm guessing SMF 1 or it would not work at all.  And also what version of TP please.

QuoteI isntalled the NiceToolTips mod and then I put the original code into a PHP block to be sure I could get it to scroll at all.  It won't scroll up.  Until I can figure out why not, I can't worry about changing the direction.

Did you get it to scroll ?  There is a little delay before it appears...
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: ZarPrime on January 30, 2011, 03:34:11 PM
Quote from: agent47 on January 28, 2011, 08:31:20 PM
Hey Zarprime,
What I am about to say may seem unbelievable but I'm going to say it anyways. Honestly and I'm not proud to say it but I didn't buy this theme but it was shared by a friend of mine so he possibly removed it. If you look at my site you'll notice that the rest of copyright links exist which means I have no reason at all to remove JUST the Dziner Studio copyright link. Like I said you may not believe me but I just had to say it. Anyways I'm trying to add Dziner Studios link as we speak.
And about the recent topics, my apologies I didn't know this was a separate mod with the marquee. I thought this was the same, basic version of the mod which is recent topics with hover over previews. Anyways still think you can help me out with removing the icon array?

agent47,

I have no reason not to believe you when you say you didn't remove the DZ Copyright.  In any case, we'll talk about this privately.  I will send you a PM.

ZarPrime
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: insanemustang on January 30, 2011, 06:25:38 PM
Quote from: Freddy on January 30, 2011, 02:21:32 PM
Hi mustang,

Can you tell me what version of SMF you are on, I'm guessing SMF 1 or it would not work at all.  And also what version of TP please.

QuoteI isntalled the NiceToolTips mod and then I put the original code into a PHP block to be sure I could get it to scroll at all.  It won't scroll up.  Until I can figure out why not, I can't worry about changing the direction.

Did you get it to scroll ?  There is a little delay before it appears...

I did not get it to scroll at all.  I did not see any text, and it did not move.  I am using SMF 2.0 RC4, and TP 1.0 RC1.
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: Freddy on January 30, 2011, 07:26:10 PM
Are you using any other javascript on your site ?
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: insanemustang on January 30, 2011, 08:24:37 PM
I don't think so.... I don't have a chat box, or shoutbox.  But I am not 100% sure.

Here are the mods I have installed:
1. TinyPortal 1.100 [ List Files ] [ Delete ]
2. Treasury 2.08  [ Uninstall ] [ List Files ] [ Delete ]
3. ENotify 2.0  [ Uninstall ] [ List Files ] [ Delete ]
4. Aeva Media 1.4  [ Uninstall ] [ List Files ] [ Delete ]
5. AJAX Instant Quick Reply 1.0.4 [ Install Mod ] [ List Files ] [ Delete ]
6. Thank-O-Matic 2.0 RC2 [ List Files ] [ Delete ]
7. Enhanced PM Warning Message 1.0  [ Uninstall ] [ List Files ] [ Delete ]
8. Google PageRank Icon 1.0  [ Uninstall ] [ List Files ] [ Delete ]
9. 2-SI Chat rev31 [ Install Mod ] [ List Files ] [ Delete ]
10. Share This Topic 2.5.1  [ Uninstall ] [ List Files ] [ Delete ]
11. Tapatalk SMF 2.0 RC4 Plugin 1.2.2 [ List Files ] [ Delete ]
12. Pm Number in All Pages 1.0 [ Install Mod ] [ List Files ] [ Delete ]
13. Contact Page 2.1.1  [ Uninstall ] [ List Files ] [ Delete ]
14. TinyPortal 1.102  [ Uninstall ] [ List Files ] [ Delete ]
15. Tapatalk SMF 2.0 RC3 Plugin 1.2.1 [ List Files ] [ Delete ]
16. Ad Managment 2.3.6.4  [ Uninstall ] [ List Files ] [ Delete ]
17. Show your social networks 1.0  [ Uninstall ] [ List Files ] [ Delete ]
18. Ultimate Profile 0.9.1  [ Uninstall ] [ List Files ] [ Delete ]
19. More Spiders 1.2  [ Uninstall ] [ List Files ] [ Delete ]
20. AjaxChat Integration 3.2.1 (modified for SMF 2 RC3) [ Install Mod ] [ List Files ] [ Delete ]
21. Join date and Location in Posts 1.1  [ Uninstall ] [ List Files ] [ Delete ]
22. Spiders Don't Increase Topic Views 1.1.1  [ Uninstall ] [ List Files ] [ Delete ]
23. Good Post/Bad Post Mod 2.0.4  [ Uninstall ] [ List Files ] [ Delete ]
24. Tapatalk SMF 2.0 RC4 Plugin 1.3.0  [ Uninstall ] [ List Files ] [ Delete ]
25. RSS Feed Poster 3.0  [ Uninstall ] [ List Files ] [ Delete ]
26. NiceTooltips 1.7  [ Uninstall ] [ List Files ] [ Delete ]
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: Freddy on January 30, 2011, 08:29:34 PM
So many mods and so little time.  I don't really have the time spare to go through all of those mods to see if they use javascript.  My guess is some of them do and that could be causing a conflict.

Are you able to set up a test site and see if this snippet works on that.  If so that would at least let you know something is incompatible.

Perhaps try this snippet in a private article and see if that works somewhat isolated from the rest of your site.

Other than that I don't know what you can do, unless one of the team has a better idea.
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: insanemustang on January 30, 2011, 10:16:24 PM
Are you able to verify that this code does work though?
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: Freddy on January 31, 2011, 11:03:25 AM
Yes it works fine.  I just copied the code from here and pasted it into a php article and bingo, I already had the tooltips mod installed.  Others have it working too.
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: insanemustang on January 31, 2011, 03:05:32 PM
Well crap then!  I could really use this.
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: Freddy on January 31, 2011, 03:15:51 PM
Did you try the things I suggested...test site, article ?
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: Freddy on January 31, 2011, 04:24:33 PM
Thinking... maybe try testing to see if the marquee will actually work on your site.

Put this in a HTML block and see if it scrolls :

<marquee>Hello</marquee>
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: insanemustang on January 31, 2011, 05:06:13 PM
That works in a html block on the frontpage, I see the word scrolling.
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: Freddy on January 31, 2011, 05:36:02 PM
Hmm, well looks like you might have some kind of conflict going on with your other mods.  I don't know what else to suggest really.. Did you get any joy from the test site/private article ?
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: insanemustang on February 03, 2011, 03:32:42 PM
It would not work in a Private article. :(
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: DukeOfAwesome on June 29, 2013, 09:23:36 AM
Hi,

I'm a total newbie when it come to SMF so please be gentle.

I am trying to implement this scrolling topics feature into my SMF 2.04 site, but everything I've read does not show where I am supposed to put the code from the topic:

[Block] Recent TOPICS scrolling with hover over previews

I've even tried to find out what these block things are but everything I've read is really cryptic and point to using SSI.php

Can someone please give me an overview of what I need to do to get this scrolling feature implemented?

Many thanks

Duke
Title: Re: [Discussion] Recent TOPICS scrolling with hover over previews.
Post by: ZarPrime on July 01, 2013, 08:08:09 PM
Hello DukeOfAwesome,

Welcome to the TinyPortal Support Site.

I assume that you are talking about the blcok code in the following topic --> http://www.tinyportal.net/index.php?topic=31643

Is that correct?  If so, I can't see where this block code has been upgraded to work with SMF 2.0.X but I will have to ask one of our coders to be sure.  In any case, you haven't even told us what version of TinyPortal, if any, you have installed.  We need more information about your site in order to assist you.  This is probably why nobody has responded thus far.  If you want us to help you, make it easy on us and yourself and Please read and respond to our Posting Guidelines (http://www.tinyportal.net/index.php?topic=581).  Specifically, we need the following information about your site ...

Quote
Link to my forum: http://www.yourdomain.com/forum/
SMF version: SMF ver. here
TP version: TP ver. here
Default Forum Language: Your Default Forum Language here
Theme name and version: Theme name here
Browser Name and Version: Browser name/version here
Mods installed: Mods listed here
Related Error messages: Error message here

ZarPrime