Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Portal_announcement
Verilog Offline
Member
***
Posts: 50
Joined: Nov 2013
Post: #6
RE: Portal_announcement
(06-07-2020 03:46 AM)RateU Wrote:  
(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 Smile
Don't forget to cache the templates to reduce the query Biggrin

I used global hook and templates to do caching of templates. Smile

(06-07-2020 03:46 AM)RateU Wrote:  
(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).

Since I wanted to use a different template for both of them, I thought about using fid using template conditional plugin to separate the content in templates. For example, I load both threads from id 10 and 11 and use different templates for their style.
Do you think that would be a good choice and solve this without using duplicate extra queries?
06-07-2020 04:51 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Portal_announcement - Verilog - 06-02-2020, 04:42 PM
RE: Portal_announcement - RateU - 06-03-2020, 03:38 AM
RE: Portal_announcement - Verilog - 06-03-2020, 04:17 PM
RE: Portal_announcement - Verilog - 06-07-2020, 02:07 AM
RE: Portal_announcement - RateU - 06-07-2020, 03:46 AM
RE: Portal_announcement - Verilog - 06-07-2020 04:51 PM
RE: Portal_announcement - RateU - 06-08-2020, 02:58 AM
RE: Portal_announcement - Verilog - 06-08-2020, 07:23 PM
RE: Portal_announcement - RateU - 06-09-2020, 01:41 AM
RE: Portal_announcement - Verilog - 06-09-2020, 06:01 PM

 Standard Tools
Forum Jump: