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

Reassigning a variable in a template with a view parameter

Discussion in 'XenForo Development Discussions' started by Neuro, Nov 19, 2014.

  1. Neuro

    Neuro Member

    I'm passing a few different variables into my template:

    Code:
        $viewParams = array('catalogthreads' => $catalogthreads,
                            'transthreads' => $transthreads);
    I'd like to create a new $threads variable and set $threads == $catalogthreads, spit out the threads, then set $threads == $transthreads, something like:

    Code:
    <div class="discussionList section sectionMain">
        <xen:set var="$threads">{xen:raw $catalogthreads}</xen:set>
            <xen:foreach loop="$threads" value="$thread">
                <xen:include template="thread_list" />
        </xen:foreach>
       <xen:set var="$threads">{xen:raw $transthreads}</xen:set>
            <xen:foreach loop="$threads" value="$thread">
                <xen:include template="thread_list" />
        </xen:foreach>
    </div>
    
    Is there a way to do this?
     
  2. Valhalla

    Valhalla Well-Known Member

    You can't use <xen:set> to assign arrays.

    Maybe you could use <xen:map>?

    <xen:map from="$transthreads" to="$threads" />

    Although I'm am unsure of your exact requirements.
     
    Neuro likes this.
  3. Neuro

    Neuro Member

    That's what i'm trying to do, at the very basic core.

    i'm trying to see if i can figure out how to use <xen:map> <xen:include> to get this to work
     

Share This Page