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

XF 1.5 How to use variable across forum

Discussion in 'XenForo Questions and Support' started by king8084, Dec 18, 2015.

  1. king8084

    king8084 Active Member

    I see this thread, and this makes sense (for the most part):
    https://xenforo.com/community/threa...in-the-page_container_js_head-template.23491/

    but i'm having problems using a var that's used in my sidebar, in my thread_view. i believe this stems from my lack of understanding on how vars are stored/accessed globally across xen. in particular, i have a 3rd party mod which uses the following:

    Code:
    <xen:foreach loop="$threads" value="$thread">
    <div id="aph_thread_{xen:raw $thread.thread_id}">
    <div class="aph_thread">
    <span style="float:left"><img src="{xen:raw $thread.forum.icon}" class="aph_thread_img" /></span>
    </div>
    </div>
    </xen:foreach>
    
    where $thread.forum.icon houses a string to an img path, set in acp.
    how can i access this image path in thread_view (or elsewhere?). adding "<xen:container var="$threadId">{$thread.thread_id}</xen:container>" allows me to get the thread ID and I have the forum ID ({$forum.node_id}) of the thread i'm looking at, but i doubt i'm really getting very close just knowing these two :(

    any help would be solid. thanks!
     
    Last edited: Dec 18, 2015
  2. Chris D

    Chris D XenForo Developer Staff Member

    That variable just might not be available to that template.

    To check you could do:

    {xen:helper dump, $thread}
    {xen:helper dump, $forum}

    Add those to your thread view template and see is witter contains the icon path.

    If they don't it will likely require some sort of back end code to expose it to the template.
     
    king8084 likes this.
  3. king8084

    king8084 Active Member

    beautiful. i never knew the helper dump existed. that was quick and easy... the var is available in the $forum piece. thanks!
     
    Chris D likes this.

Share This Page