(06-07-2020 02:07 AM)Verilog Wrote: I managed to get it to work.
Great! You now can display XThreads data wherever you want
Don't forget to cache the templates to reduce the query
(06-07-2020 02:07 AM)Verilog Wrote: Now I wanted to know if I had two different XThreads based forums and I wanted both of them on the portal in separate sections. One option is to copy the below code and replicate it with replacing templates but that feels loading extra SQL query again. Is there a way I can get different templates so that I can display them in their own style on the portal?
Well, technically, you can load the threads from different forums using
WHERE t.fid IN (10,11) and load the
$threadfield_cache not for a specific forum only.
The problem is, there is no guarantee threads from both forums will be displayed, because it depends on the
ORDER BY and the
LIMIT.
For example:
ORDER BY t.lastpost DESC
Threads from forum ID 10 and 11:
1. Threads from FID 10 - lastpost time 200
2. Threads from FID 10 - lastpost time 199
3. Threads from FID 11 - lastpost time 198
4. Threads from FID 11 - lastpost time 197
You want to load 2 threads from each forums, so you put 2 in the
LIMIT of the query. But only 1st and 2nd threads will be displayed, not all of them, even though your intent is to load 2 threads from each forum (2 threads from forum ID 10 and 2 threads from forum ID 11 in separate templates).