XF 2.0 How to get the thread ID in the PAGE_CONTAINER template.

There might be an easier way.... but you could do something like this:
Insert this code:
Code:
<xf:page option="threadID">{$thread.thread_id}</xf:page>[

Into thread_view like so:

Screenshot_3.webp


Then you can check the thread ID in page_container

Code:
<xf:if is="in_array($__globals.threadID|raw, [225,218,4])">
    Place specific thread code here for multiple thread id's
</xf:if>

Code:
<xf:if is="$__globals.threadID|raw == '225'">
    Place specific thread code here
</xf:if>
 
Thanks Russ - so finding the current thread ID at the end would be:

{$__globals.threadID|raw}

Yes?

I'm looking to pass thread ID to Google Ad Manager, not check if the thread ID is in an array.

But in any case we have come up with a solution that gives access to parent forum ID, forum ID, thread ID, and thread page number in every template. This lets us block ad tags on any template. If a particular ID doesn't exist in a template, the variable is set to 0.

It took hours to develop.

I have no idea why the software wouldn't do this out of the box, but we've corrected it at our own cost.
 
Top Bottom