TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,231
  • Total Topics: 21,353
  • Online today: 391
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 146
  • Total: 146

Add children to forum posts on front-page and/or multiple forums

Started by xadio, February 09, 2006, 12:22:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

xadio

This is partially a suggestion and partially a request for assistance.  I am trying to have the children of the chosen forum also displayed on the frontpage, however I am having trouble with the sql.

What I am trying to do is:
1) Get all msgs where t.ID_BOARD == XX (where XX is the specified board)
2) OR where the b.ID_PARENT == t.ID_BOARD
3) AND where the m.ID_MSG = t.ID_FIRST_MSG

So my first idea was to just include it where the ID_PARENT == ID_BOARD then I realized that I need to get the ID_BORD of the children and add them.  So I am doing a nested Select statement to gather the children's ID's and then just include them in the or statement. But it is to no avail.


SELECT m
.icon, m.subject, m.body, IFNULL( mem.realName, m.posterName ) AS posterName, m.posterTime, t.numReplies, t.ID_TOPIC, m.ID_MEMBER, m.smileysEnabled, b.name AS boardName
FROM smf_topics
AS t, smf_messages AS m, smf_boards AS b
LEFT JOIN smf_members
AS mem ON ( mem.ID_MEMBER = m.ID_MEMBER )
WHERE (t.ID_BOARD ='2' OR t.ID_BOARD = (
SELECT bb.ID_BOARD
FROM smf_boards
AS bb
WHERE t
.ID_BOARD = bb.ID_PARENT)
) AND
m.ID_MSG = t.ID_FIRST_MSG) AND
ORDER BY m.ID_MSG DESC
LIMIT 0
, 30


Some questions:

1) Should I just do multiple sql statements and code up the check in PHP or should I continue using SQL?
2) If I use php how would I go about resorting the $return array? (Lines 1361-1439)
3) Should I redesign the $return array to be a hash table where the key is the date/msg ID and thus they will be added chronologically?
4) OR should I redesign the output to check the post date/msg ID thus outputting it chronologically?



Thanks,
Ryan

bloc

Before going into details..you want to show childs information in full on boardindex - as opposed to current where it only displays the name/link?

xadio

No, I am refering to the frontpage using tinyportal.  As of now your portal only offers the ability to have one forum's threads displayed on the front page.  What I want for my site is to have a News Board and children of it such as:
-News
--Website
--Group
--Other

And then when you goto the homepage it will show the top XX threads from both the parent forum and children forums (of that particular parent):

.:[Example]:.
============================
Website: [Subject]             child of News
------------------------------------
[body]
============================
============================
News: [Subject]                 child of Root
------------------------------------
[body]
============================
.:[End]:.

Thanks for your quick reply.

bloc

I see. First thought would be to rather include the boards ID into the sql query, and then check in php later on the id, and apply it to different arrays, one for each board possibly. Still just one sql call, but no subselect and the parting/sorting is done only in php.

xadio

Ok, yea that makes sense, and it also sounds like a better move!  I will see what I can do.  Thanks again for your help!

Ryan

ynohtna

post the code when you figure it out!!! I would love this.  Many thanks.


dimkar

Hello I am wondering if  this has been implemented.
In my opinion it is a bit confusing if u have child boards not to show their recent posts also
on the front page.

Smoky

considering the server moves that tp has had, the code isn't showing up, after all this thread is almost, what?? over a year old.. but apparently it has been done, and presumably it was done thru block's advise.. perhaps if you tested this, and posted your results (successful or not) you can help or be helped with it..  ;)

dimkar

I have not not tried it nor tested it.
I think it is extremely useful.

This website is proudly hosted on Crocweb Cloud Website Hosting.