Hello,
I am trying to get each image in a 3 colum layout. The way I have implemented now is messy.
I searched through the forum and tried different things but can't get to work. The examples I have seen do not use a nested foreach loop like I have.
Am I going about looping through the results the wrong way for what I want to do?
Thankyou for any help.
Jeff
IF ($ueConfig['showbuddylistinprofile']==1)
{
$query = "SELECT buddyid FROM #__comprofiler_buddylist WHERE userid='".$user->id."' ";
$database->setQuery($query);
$result = '';
$result = $database->loadObjectList();
$total = count ($result);
if ($total>0)
{
$j=0;
$buddy='';
foreach($result as $preuser)
{
$buddy[$j]=$preuser->buddyid;
$j++;
}
$passtoquery='(' . implode(',', $buddy) . ')';
$query = "SELECT id,username FROM #__users WHERE id IN ".$passtoquery." AND block!=1 ORDER BY username";
$database->setQuery($query);
$buds = $database->loadObjectList();
echo "<tr><td colspan=2 align=center align=center class=\"sectiontableheader\">Buddies of ".$user->username."</td></tr>";
echo '<table cellpadding="0" cellspacing="0" border="0" width="100%">';
foreach($buds as $bud)
{
$query_avatar = "SELECT avatar FROM mos_comprofiler WHERE user_id='".$bud->id."' AND avatarapproved=1";
$database->setQuery( $query_avatar );
$pics = $database->loadObjectList();
$path = "index.php?option=com_comprofiler&task=userProfile&user=";
$thumb_path ="images/comprofiler/tn";
$no_photo = ' alt="No Photo" border=0';
foreach ($pics as $pic)
if($ueConfig['allow_profilelink']==1)
{
//I would like these results to go into a three colum layout
echo "<tr><td valign=bottom colspan=2 rowspan=3><a href=".sefRelToAbs.$path.$bud->id."><img src=".$thumb_path.$pic->avatar.$no_photo."> <br/><big>".$bud->username."</big></a></td></tr>";
}
else
{
echo $bud->username." ";
}
}
}
}