Jump to content

Dividing lots of content into multiple pages


Nicholas
 Share

Recommended Posts

I've got close to 30 or so photos on my site, and I'd like them to be displayed in sets of 10, with a "Previous" and "Next" link allowing progress backward or forward through the pictures. You've all seen it, but can you help me to do it?

Here's what I have:
[quote]
            # -------------------------------------------------
            #  photography page content
            # -------------------------------------------------
            case 'photography-s':
              print '<div align="left">' . "\n";
              connect($error, $type); [color=red]# CONNECT TO THE DATABASE[/color]
              print '<h1>my photography (<a href="http://hobbes.cjb.cc/art.php?page=photography-s">standard</a> | <a href="http://hobbes.cjb.cc/art.php?page=photography-p">panoramic</a>)</h1><br/>' . "\n";
              print '<table cellpadding="0" cellspacing="0" width="100%">' . "\n" .
             
              $_SESSION['end'] = "10"; [color=red]# SET WHAT VALUE WE NEED TO END AT [/color]
              $start = ($_SESSION['end'] - 9); [color=red]# AND WHAT WE START AT[/color]
              $end = $_SESSION['end']; [color=red]# SIMPLER FORM...[/color]

              $open = '<a href="#" onClick="MyWindow=window.open(\'';  [color=red]######################[/color]
              $mid = "','MyWindow','scrollbars=yes,";                              [color=red]## THESE ARE "SHORTCUTS"[/color]
              $close = "'); return false;\">";                                          [color=red]## IF YOU WILL[/color]
              $img = '<img class="img" border="0" src="';                      [color=red]######################[/color]
             
              for ($id=$start;$id++;$id<=$end) { [color=red]# SET UP A FOR LOOP TO GET THE DESIRED RANGE OF ID'S[/color]
                  $result = mysql_query("SELECT title, thumb, image, description, height, width FROM art_photo WHERE id ='" . ($id) . "'"); [color=red]# QUERY THE DATABASE FOR THE SPECIFIC ID'S[/color]
                  $photos = mysql_fetch_assoc($result); [color=red]# AND PLACE THAT INTO THE ARRAY "PHOTOS"[/color]
                  print $photos; [color=red]# A TEST...[/color]
                print '  <tr>' . "\n" .
                        '      <td height="120" width="160">' . "\n"; [color=red]# THE FOLLOWING COUPLE OF LINES SET UP THE CELLS CONTAINING THE PHOTOS AND DESCRIPTIONS[/color]
                print          $open . $photos["image"] . $mid . 'width=' . $photos["width"] . ',height=' . $photos["height"] . ',left=105,top=120' . $close . $img . $photos["thumb"] . '" alt="' . $photos["title"] . '" title="' . $photos["title"] . '"/></a></td>' . "\n" .
                        '      <td>' . "\n" .
                                  $photos['desc'] . "\n" .
                        '      </td>' . "\n" .
                        '  </tr>' . "\n";
                }
                print '  <tr>' . "\n" .
                        '      <td style="text-align: left;"><a href="http://hobbes.cjb.cc/art.php?page=photography-s"></td>' . "\n" . [color=red]# REWIND THE START ID[/color]
                        '      <td style="text-align: right;"><a href="http://hobbes.cjb.cc/art.php?page=photography-s"></td>' . "\n" . [color=red]# ADVANCE THE START ID[/color]
                        '  </tr>' . "\n" .
                        '</table>' . "\n";
            break;
[/quote]

Any help is greatly appreciated.
Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.