gmarik
05-16-2003, 12:37 AM
I need a picture gallery, probalby (even better) based on admin/avatars.php. It needs to have 4 modes and will be used for my portfolio. The thing is - there must be a seperating slash used as shown in these examples, can it be done (I know the way I did is wrong, but at least it works in mode 2)
Mode 1:
1 (without slash)
2 (without slash)
Mode 2:
1 / 2
3 / 4
Mode 3:
1 / 2 / 3
5 / 6 / 7
Mode 4:
1 / 2 / 3 / 5
6 / 7 / 8 / 9
<?
$cols = "2"; // 2 row mode
$query = "SELECT * FROM imglib WHERE cat='\$c' ORDER BY \$so \$o LIMIT \$initialPhoto, \$it";
if(!$result = mysql_query($query)) echo "Query failed";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$data = $row["url"];
if ($i == 0) {
echo "<tr>"; }
if (($i % $cols) == 0 ) { // if (\$i == \$cols)
echo "</tr><tr>";
echo "<tr>";
echo "<td width=\"540\" height=\"30\" colspan=\"2\" class=\"BoxBellow\">";
echo "<p> </p>";
echo "</td>";
echo "</tr>";
$i = 0; }
if ((1&$i)) { // odd shows no dotted line
echo "<td width=\"270\">";
}
if (!(1&$i)) { // even shows a dotted line
echo "<td width=\"270\" class=\"Boxright\">"; }
itemplaceholder(); //common
echo "</td>"; //common
$i++; }
if ($i != $cols)
echo "</tr>";?>
Mode 1:
1 (without slash)
2 (without slash)
Mode 2:
1 / 2
3 / 4
Mode 3:
1 / 2 / 3
5 / 6 / 7
Mode 4:
1 / 2 / 3 / 5
6 / 7 / 8 / 9
<?
$cols = "2"; // 2 row mode
$query = "SELECT * FROM imglib WHERE cat='\$c' ORDER BY \$so \$o LIMIT \$initialPhoto, \$it";
if(!$result = mysql_query($query)) echo "Query failed";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$data = $row["url"];
if ($i == 0) {
echo "<tr>"; }
if (($i % $cols) == 0 ) { // if (\$i == \$cols)
echo "</tr><tr>";
echo "<tr>";
echo "<td width=\"540\" height=\"30\" colspan=\"2\" class=\"BoxBellow\">";
echo "<p> </p>";
echo "</td>";
echo "</tr>";
$i = 0; }
if ((1&$i)) { // odd shows no dotted line
echo "<td width=\"270\">";
}
if (!(1&$i)) { // even shows a dotted line
echo "<td width=\"270\" class=\"Boxright\">"; }
itemplaceholder(); //common
echo "</td>"; //common
$i++; }
if ($i != $cols)
echo "</tr>";?>