Jump to content

page layout


chiprivers

Recommended Posts

I am wondering if somebody might be able to advise on the best way out to script the layout of my page.  I want to display some thumbnail images in a grid of 4 columns across and upto 4 rows down.  I will be displaying from the results of a query and with upto 12 records returned for each page display.

 

How would be the best way to loop through the results so that I can display them in the desired way.  Note also that I am trying to use CSS for layout the best I can instead of using tables.

Link to comment
Share on other sites

If your talking HOW TO MAKE the images display 4x4, use for loops

 

<?php
for ($x=0; $x<4; $x++)
{
  echo "<tr>";
  echo "<td>pic</td>";
  echo "<td>pic</td>";
  echo "<td>pic</td>";
  echo "<td>pic</td>";
  echo "</tr>";
}?>

 

It's going to take a little more work then that since they are pulling this data from the DB. If they were manually putting the images into the HTML, then your way would work fine. The link I posted above will show exactly how to format it from results from the database.

Link to comment
Share on other sites

It's going to take a little more work then that since they are pulling this data from the DB. If they were manually putting the images into the HTML, then your way would work fine. The link I posted above will show exactly how to format it from results from the database.

 

Thanks pocobueno1388, that was just what I was looking for.  I'm fine with the pagination (I think), but just wasn't sure of best way to sort out the dynamic display in columns.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.

×
×
  • 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.