Jump to content

HOW DO I DO THIS?? IT'S ANNOYING NOW!


Orionsbelter

Recommended Posts

Hi there i'm trying to do something very simple but do not know how too. Please look at this link http://www.uo.com.au/accessories.cfm?t=/belts/ see the products are in rows on each row there is 4 belts then they start  a new row.

 

I'm building a shop where i want to Echo all products of a certain category for example say am selling belts like the site above.

 

I want echo each product in a div box and the product image inside, i need the script to put each div box next to each other (side by side ) like the link shows. Then after it gets to a fourth belt it should then start a new row of products under it to stop overflowing.

 

Can anybody help?

Link to comment
https://forums.phpfreaks.com/topic/196851-how-do-i-do-this-its-annoying-now/
Share on other sites

Thank you for your suggestion but i would rather not use a program over personal coding :D

 

believe me, u would not try to take risk of recreating it all again..it would be more easier if u use this code..

http://www.alegrocart.com/ this is the link..

I don't see why this is so difficult.

 

You know how to retrieve data from the db, correct?  If so, just do something like:

 

$count = 0;

while($row = mysql_fetch_assoc($result))
{
   if ($count % 4 == 0) { echo '<br /'>; }

   echo '<div class="item"><img src="path/to/image" alt="' . $row['alt'] . '" /></div>';
   ++$count;
}

 

Where the div's class sets its size and floats it to the left.

I don't see why this is so difficult.

 

You know how to retrieve data from the db, correct?  If so, just do something like:

 

$count = 0;

while($row = mysql_fetch_assoc($result))
{
   if ($count % 4 == 0) { echo '<br /'>; }

   echo '<div class="item"><img src="path/to/image" alt="' . $row['alt'] . '" /></div>';
   ++$count;
}

 

Where the div's class sets its size and floats it to the left.

 

You can also accomplish this by using CSS. Give each div a class so they all have the same width and add float: left; If the total size of your divs is greater than it's containing div then it will be automatically be pushed to the next line.

I don't see why this is so difficult.

 

You know how to retrieve data from the db, correct?  If so, just do something like:

 

$count = 0;

while($row = mysql_fetch_assoc($result))
{
   if ($count % 4 == 0) { echo '<br /'>; }

   echo '<div class="item"><img src="path/to/image" alt="' . $row['alt'] . '" /></div>';
   ++$count;
}

 

Where the div's class sets its size and floats it to the left.

 

You can also accomplish this by using CSS. Give each div a class so they all have the same width and add float: left; If the total size of your divs is greater than it's containing div then it will be automatically be pushed to the next line.

 

That's true.  I tend to add the linebreak just for completeness' sake.

Archived

This topic is now archived and is closed to further replies.

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