XF 2.2 Fetch some threads, sort by forums


Well-known member
Hmm, i am stuck here.

I fetch something like:
select from thread where (thread_id = or node =)
when I use


I also get the Forum inside my column.
But now I have no idea how to fetch the forums and how to sort the threads by forums.
I start at the end:

in a template i would like to do:

foreach $forums as $forum
show node.title
foreach $threads as $thread
show thread

i can fetch my threads, my forums (some threads have node_id not in the list of forums!)
i can fetch threads with forum
I can use sql and group by node_id, but for what?
I dont know how to group in a result (there is one sentence about in the docs)
Should i produce a new array with

nodes = [
=> node_title
=> threads => (thread_id) => thread

=> node_title
=> threads => (thread_id) => thread

What is the best way with

forum1, forum2
thread (forum1)
thread (forum2)
thread (forum3)

to have:

rest of threads not in forum1 or 2
Top Bottom