我已经在这几个小时了,
我想将结果随机化,并且没有规定从后端做到这一点。
<?php foreach( $this->friends as $membership ):
if( !isset($this->friendUsers[$membership->resource_id]) ) continue;
$member = $this->friendUsers[$membership->resource_id];
?>
<li id="user_friend_<?php echo $member->getIdentity() ?>">
<?php echo $this->htmlLink($member->getHref(), $this->itemPhoto($member, 'thumb.icon'), array('class' => 'profile_friends_icon')) ?>
<div class='profile_friends_body'>
<div class='profile_friends_status'>
<span>
<?php echo $this->htmlLink($member->getHref(), $member->getTitle()) ?>
</span>
<?php //echo $member->status; ?>
</div>
<?php if( $this->viewer()->isSelf($this->subject()) && Engine_Api::_()->getApi('settings', 'core')->getSetting('user.friends.lists')): // BEGIN LIST CODE ?>
<div class='profile_friends_lists' id='user_friend_lists_<?php echo $member->user_id ?>'>
<span class="pulldown" style="display:inline-block;" onClick="toggleFriendsPulldown(event, this, '<?php echo $member->user_id ?>');">
<div class="pulldown_contents_wrapper">
<div class="pulldown_contents">
<ul>
<?php foreach( $this->lists as $list ):
$inList = in_array($list->list_id, (array)@$this->listsByUser[$member->user_id]);
?>
<li class="<?php echo ( $inList !== false ? 'friend_list_joined' : 'friend_list_unjoined' ) ?> user_profile_friend_list_<?php echo $list->list_id ?>" onclick="handleFriendList(event, $(this), '<?php echo $member->user_id ?>', '<?php echo $list->list_id ?>');">
<span>
<a href="javascript:void(0);" onclick="deleteFriendList(event, <?php echo $list->list_id ?>);">x</a>
</span>
<div>
<?php echo $list->title ?>
</div>
</li>
<?php endforeach; ?>
<li>
<input type="text" title="<?php echo $this->translate('New list...') ?>" onclick="new Event(event).stop();" onkeypress="if( new Event(event).key == 'enter' ) { createFriendList(event, $(this), '<?php echo $member->user_id ?>'); }" />
</li>
</ul>
</div>
</div>
<a href="javascript:void(0);"><?php echo $this->translate('add to list') ?></a>
</span>
</div>
<?php endif; // END LIST CODE ?>
</div>
<div class='profile_friends_options'>
<?php echo $this->userFriendship($member) ?>
</div>
</li>
需要随机化结果.. 我尝试过使用
rand()
但这似乎是流产的。 请帮忙