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

Variables in template foreach

Discussion in 'XenForo Development Discussions' started by bambua, Nov 7, 2010.

  1. bambua

    bambua Well-Known Member

    I've got the following template
    Code:
    <div class="section staffOnline avatarList">
    	<div class="secondaryContent">
    	<h3>{xen:phrase recent_status_updates}</h3>
    		<xen:if is="{$xfRecentStatus}">
    			<ul>
    				<xen:foreach loop="$xfRecentStatus" value="$user">
    					<li  onClick="showSlidingDiv(); return false;">
    						<xen:avatar user="$user.user" size="s" img="true" />
    						<a href="{xen:link members, $user.user}" class="username">{xen:helper richUserName, $user.user}</a><xen:datetime time="$user.time" />
    						<div class="userTitle">{$user.status}</div>
    						<ul id="RecentStatus{$user.post_id}" onClick="showSlidingDiv(); return false;" style="display:none;">
    							<xen:foreach loop="xfRecentStatusComments.{$user.post_id}" value="$commentuser">
    								<li>
    									<xen:avatar user="$commentuser.user" size="s" img="true" />
    									<a href="{xen:link members, $commentuser.user}" class="username">{xen:helper richUserName, $commentuser.user}</a><xen:datetime time="$commentuser.time" />
    									<div class="userTitle">{$commentuser.status}</div>
    								</li>
    							</xen:foreach>
    						</ul>
    					</li>
    				</xen:foreach>
    			</ul>
    		</xen:if>
    	</div>
    </div>
    
    The bit I'm having a problem with is this:
    Code:
    <xen:foreach loop="xfRecentStatusComments.{$user.post_id}" value="$commentuser">
    
    I need to get the post_id from the first part of the loop as the key for a multi dimensional array. I've tried like 10 different combinations of ways to pull that array through and just can't find something. Any ideas?
     
  2. bambua

    bambua Well-Known Member

    Figured it out so stupid, I had xfRecentStatusComments instead of $xfRecentStatusComments...sometimes you need to just stop staring at code.
     
    kkm323 likes this.

Share This Page