News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

How Can I Display Recent Topics from One Category Only?

Started by swiftmed, June 09, 2010, 11:21:23 AM

Previous topic - Next topic

swiftmed

Hey Guys,

I am trying to use SSI.php to display recent posts in one specific category. I have taken the following piece of code from the ssi examples page, but am not sure what exactly I need to change in order to display output from a specific category on my forum.


<?php ssi_recentTopics($num_recent 8$exclude_boards null$include_boards null$output_method 'echo'); ?>

Could anybody help please?
With Regards,
Andrew MacDonald

http://cherylanncole.co.uk/forums
SMF 2.0 RC2

Arantor


swiftmed

With Regards,
Andrew MacDonald

http://cherylanncole.co.uk/forums
SMF 2.0 RC2

Arantor

That's a board, not a category and it's board 29.

That means, you can put it into your line above...

<?php ssi_recentTopics($num_recent 8$exclude_boards null$include_boards = array(29), $output_method 'echo'); ?>

swiftmed

With Regards,
Andrew MacDonald

http://cherylanncole.co.uk/forums
SMF 2.0 RC2

swiftmed

Hey Arantor,

Could I have your advice please? I am having a bit of a problem with implementing the line of code above into my site, and getting the correct output. Upon using it, it perfectly displays topics from the category in question, however the amount of entries its showing keeps changing.

One minute there are 8, one minute there are 2 posts, etc etc. I have it setup to show 10 recent posts - theres more than enough content in the category, but im not sure what is going on here?

This is the code im using:
<?php ssi_recentTopics($num_recent 10$exclude_boards null$include_boards = array(29), $output_method 'echo'); ?>

You can see the output at www.cherylanncole.co.uk - If your seeing what im seeing right now, there are only 2 posts showing in the box. What am I doing wrong?
With Regards,
Andrew MacDonald

http://cherylanncole.co.uk/forums
SMF 2.0 RC2

Arantor

I see 7 right now, but the reason is nothing you've done wrong. There is a limiting factor built into ssi_recentTopics to prevent it scanning too much of the database. As new posts are made, depending on where they are in the forum, that affects how far back the recentTopics goes.

Take a look in the code for ssi_recentTopics; there's a formula that involves either a - 25 * something or - 35 * something component. Make the number bigger, but the bigger the number the slower it gets to process.

swiftmed

Quote from: Arantor on June 10, 2010, 05:26:59 PM
I see 7 right now, but the reason is nothing you've done wrong. There is a limiting factor built into ssi_recentTopics to prevent it scanning too much of the database. As new posts are made, depending on where they are in the forum, that affects how far back the recentTopics goes.

Take a look in the code for ssi_recentTopics; there's a formula that involves either a - 25 * something or - 35 * something component. Make the number bigger, but the bigger the number the slower it gets to process.

Ahh I see. I've found the section you are talking about, its on -25 and I've changed it to - 35, see how that goes. As always, thanks for your advice sir.
With Regards,
Andrew MacDonald

http://cherylanncole.co.uk/forums
SMF 2.0 RC2

swiftmed

Forgive me for bringing this topic back to life, but I need your advice, once again about the same issue.

When I increased that thing to 35 the other day as you said, the amount of posts that showed up in the x factor category did increase, but it's fluctuating again.

Take a look at www.cherylanncole.co.uk - you will see there are two topics in 'The X Factor' recent topics, but in the general 'Recent Topics' section just below that, there are the correct number of topics showing up, as stated in the code (10).

Why is this not happening for The X Factor category? Surely it should be displaying 10 topics, as specified, just like the recent topics in the section below it? To be clear, the general recent topics which is the second box on my home page is displaying completely as specified, and has done since I installed it. No fluctuation, not even when I added The X Factor recent topics. Whereas the new box is fluctuating, and I don't know why. I want it to display 10 topics, but as I said, it's all over the place.

What can I do to fix this? Here is the code I am using for each of the sections:

The X Factor Recent Topics
<?php ssi_recentTopics($num_recent 10$exclude_boards null$include_boards = array(29), $output_method 'echo'); ?>

General Recent Topics
<?php ssi_recentTopics(); ?>
With Regards,
Andrew MacDonald

http://cherylanncole.co.uk/forums
SMF 2.0 RC2

Deaks

~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

Advertisement: