ActaNonVerba1 Posted January 25, 2011 Share Posted January 25, 2011 Hey guys This is the first loop i have attempted on my own, so please tell me if ive done something completely stupid.. What happens is the suer specifies a number of thumbnails on the previous page, these are posted to the form and then that amount of thumbnails should be displayed. Heres what i have so far $cd = 0; while ($cd < $numberofthumbnails) { $displaythumbs . '<div class="ThumbnailHolder"> <div class="LeftThumb"><a class="group" href="../../../Images/Lighthouses/Beachy-Head/1.png"><img src="../../../Images/Lighthouses/Beachy-Head/Mini/Thumbnail-1.png" width="430" height="200" alt="Thumbnail 1"></a></div> <div class="RightThumb"><a class="group" href="../../../Images/Lighthouses/Beachy-Head/2.png"><img src="../../../Images/Lighthouses/Beachy-Head/Mini/Thumbnail-2.png" width="430" height="200" alt="Thumbnail 2"></a></div></div> '; $cd++; } Essentially what im trying to do is as thumbnail code to $displaythumbs for each time the loop goes round. What am i doing wrong? Thanks Danny. Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted January 25, 2011 Share Posted January 25, 2011 I'm not sure what's going on with "LeftThumb" and "RightThumb". But if you're trying to display one thumbnail per loop, you want to utilize the $cd variable in the loop. For example: for($cd=0; $cd < $numberofthumbnails; $cd++) { $displaythumbs . '<div class="ThumbnailHolder">'; $displaythumbs . '<div><a class="group" href="../../../Images/Lighthouses/Beachy-Head/' . $cd . '.png"><img src="../../../Images/Lighthouses/Beachy-Head/Mini/Thumbnail-' . $cd . '.png" width="430" height="200" alt="Thumbnail ' . $cd . '"></a></div>'; $displaythumbs . '</div>'; } Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted January 25, 2011 Share Posted January 25, 2011 Set $displaythumbs = ''; before the loop. Then use $displaythumbs .= inside the loop. Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted January 25, 2011 Share Posted January 25, 2011 Set $displaythumbs = ''; before the loop. Then use $displaythumbs .= inside the loop. Yep, thanks for pointing those issues out. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.