Kirk Y
06-24-2006, 11:36 PM
I've got a page displaying the members' profile pictures. The problem is that all the pictures are being placed on one line, so I'm trying to figure out how to add a <tr> after 5 images have been displayed. I've seen a few gallery hacks do this, but I only partially understand the process. This is what I've got so far:
$users = $db->query_read("
SELECT *
FROM user
");
$userstotal = $db->query_read("
SELECT username
FROM user
");
$user_count = mysql_num_rows($userstotal);
while ($userinfo = $db->fetch_array($users))
{
if ($vbulletin->options['usefileavatar'])
{
$userinfo['profilepicurl'] = $vbulletin->options['profilepicurl'] . '/profilepic' . $userinfo['userid'] . '_' . $userinfo['profilepicrevision'] . '.gif';
}
else
{
$userinfo['profilepicurl'] = 'image.php?' . $vbulletin->session->vars['sessionurl'] . 'u=' . $userinfo['userid'] . "&dateline=$userinfo[profilepicdateline]&type=profile";
}
$username = $userinfo['username'];
$userid = $userinfo['userid'];
$userinfopic .= "<td class=\"alt2\" height=\"100\" width=\"120\" align=\"center\"><b>$username</b><br /><img src=\"" . $userinfo['profilepicurl'] . "\" alt=\"\" title=\"$userinfo[username]'s picture\" border=\"0\"";
$userinfopic .= ($userinfo['ppwidth'] AND $userinfo['ppheight']) ? " width=\"$userinfo[ppwidth]\" height=\"$userinfo[ppheight]\" " : '';
$userinfopic .= "/></td>";
}
So I use $userinfopic to display the images and I added a query to determine the number of rows. I tried using this in my template:
<if condition="$user_count > '5'">
</tr><tr>
</if>
But it's being added after userinfopic, so it's obviously not having an effect on the 6th image. If it's not obvious by now, I'm clueless as to how to proceed. If someone wouldn't mind pointing me in the right direction, it'd be much appreciated.
$users = $db->query_read("
SELECT *
FROM user
");
$userstotal = $db->query_read("
SELECT username
FROM user
");
$user_count = mysql_num_rows($userstotal);
while ($userinfo = $db->fetch_array($users))
{
if ($vbulletin->options['usefileavatar'])
{
$userinfo['profilepicurl'] = $vbulletin->options['profilepicurl'] . '/profilepic' . $userinfo['userid'] . '_' . $userinfo['profilepicrevision'] . '.gif';
}
else
{
$userinfo['profilepicurl'] = 'image.php?' . $vbulletin->session->vars['sessionurl'] . 'u=' . $userinfo['userid'] . "&dateline=$userinfo[profilepicdateline]&type=profile";
}
$username = $userinfo['username'];
$userid = $userinfo['userid'];
$userinfopic .= "<td class=\"alt2\" height=\"100\" width=\"120\" align=\"center\"><b>$username</b><br /><img src=\"" . $userinfo['profilepicurl'] . "\" alt=\"\" title=\"$userinfo[username]'s picture\" border=\"0\"";
$userinfopic .= ($userinfo['ppwidth'] AND $userinfo['ppheight']) ? " width=\"$userinfo[ppwidth]\" height=\"$userinfo[ppheight]\" " : '';
$userinfopic .= "/></td>";
}
So I use $userinfopic to display the images and I added a query to determine the number of rows. I tried using this in my template:
<if condition="$user_count > '5'">
</tr><tr>
</if>
But it's being added after userinfopic, so it's obviously not having an effect on the 6th image. If it's not obvious by now, I'm clueless as to how to proceed. If someone wouldn't mind pointing me in the right direction, it'd be much appreciated.