Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Angelotus on August 06, 2008, 01:34:15 PM

Title: SSI recentpost per board
Post by: Angelotus on August 06, 2008, 01:34:15 PM
Hi, how do I show recent posts just from one board in 2.0? I see there is an include function but I don't know how to use this?
Title: Re: SSI recentpost per board
Post by: H on August 06, 2008, 01:54:38 PM
function ssi_recentPosts($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'echo')

I think you can just leave $exclude_boards blank so if the board ID was 1 you should be able to do:

ssi_recentPosts(,,1);
Title: Re: SSI recentpost per board
Post by: Angelotus on August 06, 2008, 02:09:44 PM
Well, tried that already but didn't worked. Actually the whole page doesn't load then.
Title: Re: SSI recentpost per board
Post by: mike_sw on August 06, 2008, 04:06:02 PM

ssi_recentPosts(8,null,1);

;)
Title: Re: SSI recentpost per board
Post by: Angelotus on August 06, 2008, 04:08:52 PM
doesn't work either
Title: Re: SSI recentpost per board
Post by: mike_sw on August 06, 2008, 04:11:00 PM
OK, you need to find out the id of your board. In the example the id was assumed to be 1 (the 3rd parameter).
Title: Re: SSI recentpost per board
Post by: Angelotus on August 06, 2008, 04:11:57 PM
Yes I have already, board nr 34. There are 2 post in there at the moment and they are not showing up.
Title: Re: SSI recentpost per board
Post by: H on August 06, 2008, 04:12:38 PM
Anything in any error logs? (SMF or web-server)

Does it work on any other boards? (Perhaps it only checks recent posts since a certain time? I haven't looked too closely at the function)
Title: Re: SSI recentpost per board
Post by: Angelotus on August 06, 2008, 04:16:16 PM
No errors. The function does work for all, only not if I select one board as given in the example above.
Title: Re: SSI recentpost per board
Post by: mike_sw on August 06, 2008, 04:17:50 PM
I've just tried this function and it displays my last 3 posts (on my local test forum).

My test on smf 2 beta 3.1

<?php
//include SSI 
require(  'forum/SSI.php');
ssi_recentPosts(8,null,1);
?>




Title: Re: SSI recentpost per board
Post by: Angelotus on August 06, 2008, 04:22:37 PM
^^ my settings are correct, have included SSI correct as everything else included works fine. It's just this function that isn't working for me.

Can it be that it has to do something with the fact that the board is only visable for 1 group? Although I am a part of that particular group I still don't see a thing.
Title: Re: SSI recentpost per board
Post by: mike_sw on August 06, 2008, 04:25:38 PM
I think you should try first to make the board accesible to anyone and see if that works. It might be a permission problem.
Title: Re: SSI recentpost per board
Post by: Angelotus on August 06, 2008, 04:29:11 PM
Well. I have tried that as well and unfortunatelly no succes either... :(

Maybe someone is willing to take a look at my SSI included here? Thanks in advance!!!
Title: Re: SSI recentpost per board
Post by: mike_sw on August 07, 2008, 02:17:12 AM
Yeap, it's a different SSI.php . It looks like smf beta 3.0 . However it's strange that is almost double in size than mine.
Title: Re: SSI recentpost per board
Post by: Angelotus on August 07, 2008, 02:29:18 AM
That could be, because I have much modifications and addons made in it.
I have checked my version against your version of recentpost function. Except for the output (have made a little tweak in the table) the codings are the same. Have tested it already and still no luck.
I am getting really confused about this...
Title: Re: SSI recentpost per board
Post by: Dragooon on August 07, 2008, 02:36:42 AM
OK Time to do some debugging.
Try adding this to your page
global $context;
echo $context['user']['is_logged'] ? $context['user']['name'] : 'Guest';

Anywhere after SSI is called, what does it says there?
Title: Re: SSI recentpost per board
Post by: Angelotus on August 07, 2008, 02:42:53 AM
When logged in it gives my name, when logged out is says ┬┤Guest┬┤
Title: Re: SSI recentpost per board
Post by: Dragooon on August 07, 2008, 02:48:11 AM
Can you post your full file?
Title: Re: SSI recentpost per board
Post by: Angelotus on August 07, 2008, 02:51:28 AM
Here is my SSI and my custom page Club.php
Title: Re: SSI recentpost per board
Post by: Dragooon on August 07, 2008, 02:57:23 AM
Try this
Title: Re: SSI recentpost per board
Post by: Angelotus on August 07, 2008, 03:03:31 AM
Thanks, but no results still...
Title: Re: SSI recentpost per board
Post by: Dragooon on August 07, 2008, 03:04:33 AM
Does your other SSI function like ssi_mededelingclub(33, 1, 0, 400) work?
Title: Re: SSI recentpost per board
Post by: Angelotus on August 07, 2008, 03:06:25 AM
Yes, those work! So I guess it has to do something with the recentpost function...but I've looked at it till I got dizzie and unfortunatelly I couldn't find what is wrong with it....
Title: Re: SSI recentpost per board
Post by: mike_sw on August 07, 2008, 05:10:13 AM
I've used your SSI instead of mine for testing and it doesn't work indeed. With the default SSI works, so the problem is somewhere in the modded SSI.

OK got it:
Your function has a modified signature, so the correct calling is

ssi_recentPosts(8,null,'echo',1);


The order of the params got changed somehow and now(default smf 2 beta 3.1) the echo is the last instead of the 3rd.
Title: Re: SSI recentpost per board
Post by: Angelotus on August 07, 2008, 05:27:09 AM
Wow, thank you so much mike_sw and Dragooon! It works fine now! I have no idea how params got changed though!