1. 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?

Discussion in 'XenForo Questions and Support' started by robdog, Nov 20, 2011.

  1. robdog

    robdog Well-Known Member

    Working with good DFP and I need to see if there is a valid thread_id.

    Any ideas?
  2. robdog

    robdog Well-Known Member


    figured this out.
  3. Chimpie

    Chimpie Well-Known Member

    How did you do it?
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Edit this template:

    Admin CP -> Appearance -> Templates -> thread_view

    Add this line to the top of each template:

    <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:

    <xen:if is="{$threadId} == 2">
    thedude and marring like this.
  5. marring

    marring Member

    Dear Jake Bunce,

    after that in php module/addons, can we use the variable $threadID?
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    What exactly are you trying to accomplish?
  7. marring

    marring Member

    For example: I want to write a block/module for xenporta, I want to get the current threadid's article view.
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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. marring

    marring Member


    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!
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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).

Share This Page