Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: pheltzer on June 17, 2005, 09:41:15 AM

Title: Getting Last Post from Child Board on Index
Post by: pheltzer on June 17, 2005, 09:41:15 AM
I wasn't quite sure where to post this question so it's ending up here... if I should move this let me know.

Our forums have a fairly structured heirarchy of boards and child boards along the lines of this:

Board A
     Child 1
          Grandchild a
          Grandchild b
     Child 2
          Grandchild c
          Grandchidl d
          Grandchild e
Board B
      Child 3
          Grandchild f
          Grandchild g
      Child 4
          grandchild h
          grandchild i

etc...

What I'd like to do is on the forum index show the Last Post text for the most recent post in one of the child or grandchild boards (i.e. Today at 10:15 in Topic Name by User) with a link to that post. This works at the child level, where it will show me the most recent post in one of the grandchild boards. But at the index level it doesn't show anything in the last post column. Is there a way to make this happen
Title: Re: Getting Last Post from Child Board on Index
Post by: pivo on June 20, 2005, 04:00:05 AM
Doesn't this work? Replace X with the number of the (grand)childboard.


$array = ssi_boardNews(X, 1, null, 250, 'array');
foreach ($array as $news)
{
echo $news['time'], '<a href="', $news['href'], '">', $news['subject'], '</a>';
}


Don't forget that for your SSI to work the first line (before the head-section) must be:

require("/path/to/your/forum/SSI.php");
Title: Re: Getting Last Post from Child Board on Index
Post by: pheltzer on June 20, 2005, 03:53:29 PM
Maybe I'm misunderstanding the answer... but I'm not looking for the post of a specific child board just a total of all the children and whatever the last post in any of the children/grandchildren were.
Title: Re: Getting Last Post from Child Board on Index
Post by: pivo on June 21, 2005, 04:57:12 AM
If you use the above code for every board and childboard of your forum, you create a list of the most recent topic of each board. So you'll get one post for each board.

If you just need "the" most recent topic of all your boards, there's a simple SSI example of this:

http://www.simplemachines.org/community/ssi_examples.php