Customizing SMF > SMF Coding Discussion
[SSI] ssi_recentTopics not displaying all topic
(1/1)
diontoradan:
Im using ssi_recentTopics to display numbers of topics on several boards. If set it to ssi_recentTopics(30, array(boardnumber), null, return).
it works to display updates in all boards, but on certain board, it only displayed less than 30 post.
Is there a time constrain for post that displayed in ssi_recentTopics? how can i display all updates, not just the ones that recently posted?
Okay i found out my self, i've decided to hardcode the SSI.php, for those of you who need this, check below :
- FIND :
--- Code: --- WHERE t.id_last_msg >= {int:min_message_id}
' . (empty($exclude_boards) ? '' : '
AND b.id_board NOT IN ({array_int:exclude_boards})') . '
' . (empty($include_boards) ? '' : '
AND b.id_board IN ({array_int:include_boards})') . '
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}' : '') . '
--- End code ---
REPLACE WITH :
--- Code: ---WHERE t.approved = {int:is_approved}
' . (empty($exclude_boards) ? '' : '
AND b.id_board NOT IN ({array_int:exclude_boards})') . '
' . (empty($include_boards) ? '' : '
AND b.id_board IN ({array_int:include_boards})') . '
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND m.approved = {int:is_approved}' : '') . '
--- End code ---
as you can see i delete the " t.id_last_msg >= {int:min_message_id} ", i dont know what it does, all i know it limits all updates to be displayed.
after i edit the function, all post are displayed like i wanted.
Arantor:
Yes, there is a very good reason for doing that: performance. By deliberately restricting the table to a reasonable percentage of topics rather than having to explore all of them, it really, really helps the query from being slow later on.
Odds are you don't have that many topics right now and as such it excludes too many.
Also, doing it the way you've done it is also a bad idea, the order of criteria actually used is important because that's the order MySQL will apply the criteria, and ideally the board filtering should be done first in almost all cases. (And it's broken, too, since you're *ONLY* supposed to put the approved criteria if post moderation is actually active anyway)
If you're determined to do this in this fashion, the correct version would be:
--- Code: ---WHERE 1 = 1' . (empty($exclude_boards) ? '' : '
AND b.id_board NOT IN ({array_int:exclude_boards})') . '
' . (empty($include_boards) ? '' : '
AND b.id_board IN ({array_int:include_boards})') . '
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}' : '') . '
--- End code ---
Or you could use the original code and just reset the definition of min_message_id.
diontoradan:
Thanks for the input, i will try your code. I'm still don't quite understands whats "min_message_id" for.
I try to input 55, 75, 1000 to replace the default 35 and it still doing the same thing.
What should i do to reset this?
'min_message_id' => $modSettings['maxMsgID'] - 35 * min($num_recent, 5),
All i want to achieve is very simple, displaying the latest topics in selected board.
Arantor:
As I explained, min_message_id is used to limit the number of topics selected. I didn't get into the details because I didn't really think it was relevant, but basically it takes the highest known message id, knocks off a number and makes sure the topics you call are within a recent period of time compared to the most recent message, specifically to limit how far back it goes.
Consider the title: *recent* topics. It isn't 'last 10 replied to topics', it is a selection of the most recent topics.
If you want to reset that to work how you want:
--- Code: ---'min_message_id' => 0,
--- End code ---
It's still going to hurt if you want to guarantee getting a number of topics but that's going to hurt a lot less than the other proposed changes.
diontoradan:
okay thanks for the reply... its very helpfull...
Problem solved... :laugh:
Navigation
[0] Message Index
Go to full version