Results 1 to 6 of 6

Thread: Picture gallery loop

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2003
    Location
    L.A.
    Posts
    6

    Thumbs up Picture gallery loop

    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)

    PHP Code:
    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>&nbsp;</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>";?>
    Want a dynamic site with nice graphics? Solutions for the new age. Marco Tech
    vBulletin skins | Button sets | Free Photoshop addons | Web templates | PHP

  2. #2
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    am I missing something? you said that works in mode 2 yet you are not echoing anything from the database. also you html has a lot to be desired, you open 2 <tr> and you don't close other cells.

    so you are trying to make mode 4 happen?

    you have to get the total number of rows from the query and if over a certain amount then you do which ever mode you want

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2003
    Location
    L.A.
    Posts
    6
    3 and 4 not working for me. Can you help out?
    Want a dynamic site with nice graphics? Solutions for the new age. Marco Tech
    vBulletin skins | Button sets | Free Photoshop addons | Web templates | PHP

  4. #4
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    and like I said, how is 1 and 2 working when you don't even have anything outputted? I told you what to do, I am not writing the code for you but I will help you out.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2003
    Location
    L.A.
    Posts
    6
    But 2 works, doen't know how, but it does.
    Want a dynamic site with nice graphics? Solutions for the new age. Marco Tech
    vBulletin skins | Button sets | Free Photoshop addons | Web templates | PHP

  6. #6
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    I don't either, it shouldn't

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width