News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Getting Last Post from Child Board on Index

Started by pheltzer, June 17, 2005, 09:41:15 AM

Previous topic - Next topic

pheltzer

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

pivo

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");

pheltzer

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.

pivo

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

Advertisement: