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

Variables in template foreach

bambua

Well-known member
#1
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?
 

bambua

Well-known member
#2
Figured it out so stupid, I had xfRecentStatusComments instead of $xfRecentStatusComments...sometimes you need to just stop staring at code.