Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: profzelonka on May 02, 2017, 11:30:06 PM

Title: Is it possible to display topic *with* all replies (SSI)
Post by: profzelonka on May 02, 2017, 11:30:06 PM
I'm attempting to make a simple "facebook-like feed" of site's most recent topics displayed one after the other with replies. The plan is to heavily modify the design to resemble facebook's simple post/comment design.

Is it possible to display all replies with the next topic below the first topic, and so forth?
If I figure out how to display the comments, not only the initial post, then the rest I can manipulate well and achieve my goal.

The idea is to make a custom page using SSI-based code possibly, or what ever it takes to display top # of recent topics in full with comments, topic after topic in a vertical table.
Title: Re: Is it possible to display topic *with* all replies (SSI)
Post by: Arantor on May 03, 2017, 03:03:18 AM
It's possible but not out of the box with SSI meaning you'll need to write it yourself from scratch or get someone else to write it, and doing it that way would impose a non trivial performance problem on your server anyway.
Title: Re: Is it possible to display topic *with* all replies (SSI)
Post by: profzelonka on May 03, 2017, 07:20:40 PM
Thank you.

Quote from: Arantor on May 03, 2017, 03:03:18 AM
would impose a non trivial performance problem on your server anyway.

Could you elaborate on this?
Title: Re: Is it possible to display topic *with* all replies (SSI)
Post by: Arantor on May 04, 2017, 02:40:11 AM
Fetching each of the most recent topics with all of their replies isn't efficient because you largely have to handle it either with queries per topic or a few very careful queries to get everything and filter it down. This tends to be very, very slow especially if you're trying to copy Facebook which doesn't actually do it that way at any point.
Title: Re: Is it possible to display topic *with* all replies (SSI)
Post by: profzelonka on May 04, 2017, 11:35:50 PM
Thank you.
Title: Re: Is it possible to display topic *with* all replies (SSI)
Post by: Sesquipedalian on May 18, 2017, 04:41:14 AM
For the reasons Arantor said, I would take it easy with the following, but you might be able to do it using the  SSI Topic and Replies (https://custom.simplemachines.org/mods/index.php?mod=751) mod. First use ssi_recentTopics() to get the a list of recent topics, then loop through the topic IDs in the result, passing each one to ssi_topic(). It'll be slow, though, so you should probably consider carefully whether this is really what you want to do.