• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 How to get the current thread id being viewed in the page_container_js_head template?

Jake Bunce

XenForo moderator
Staff member
#4
Edit this template:

Admin CP -> Appearance -> Templates -> thread_view

Add this line to the top of each template:

Code:
<xen:container var="$threadId">{$thread.thread_id}</xen:container>
Now you can use {$threadId} in the PAGE_CONTAINER and other templates, and in conditions like this:

Code:
<xen:if is="{$threadId} == 2">

</xen:if>
 

Jake Bunce

XenForo moderator
Staff member
#8
For example: I want to write a block/module for xenporta, I want to get the current threadid's article view.
You would have to write code to query the thread record and make it available to the block. This involves custom programming, not just template functions.
 
#9
sure.

But this block/module is not render the article, because xenporta do before. It is just get the current threadid of xenporta's view and and want to use it in my custom module/block.

For example: display more articles exclude the current in the list below the current article.

Is there anyway to do? Thanks so much!
 

Jake Bunce

XenForo moderator
Staff member
#10
I am not familiar with the code behind XenPorta's block system. I don't know how the scope works. If the blocks are in the container scope then my previous code will work (using xen:container).