Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Nested repeat and horizontal loop, I think?

Participant ,
Jul 29, 2007 Jul 29, 2007
Nested repeat and horizontal loop, I think as I am stuck on a small issue with a nested repeat region which is needed and looping through it horizontally with or without tables.

Like 2 or 3 per columns but horizontally?
==========================
Categoryname1
Image //for this category
Image //for this category
==========================
Categoryname2
Image //for this category
Image //for this category
==========================
Is there anything for this as I am pulling my hair out over this one?
Thanks in advance!
TOPICS
Server side applications
717
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Aug 06, 2007 Aug 06, 2007
IF(language = PHP) {
This is a really good bit of code i got from someone here, what it does is display the results of a recordset horizontally, i used it for displaying thumbnails, with some modification you could probably make it work how you want. The $cols variable sets the number of columns per row. Substitute your recordset and change the variables and it should work

//START CODE BLOCK
$picturelocsql = "SELECT images.img_id, images.description, images.name, images.location, images.upload_...
Translate
Participant ,
Jul 29, 2007 Jul 29, 2007
bump...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 06, 2007 Aug 06, 2007
did you ever get an answer for this? I could use the answer here also
Thanks
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 06, 2007 Aug 06, 2007
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 06, 2007 Aug 06, 2007
Thanks for the link, Unfortunately that doesn't do what I need. The Simulated Nested Region extension is a little closer but very unstable and hard to control the result unless you do only what the example shows.

Dave
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 06, 2007 Aug 06, 2007
IF(language = PHP) {
This is a really good bit of code i got from someone here, what it does is display the results of a recordset horizontally, i used it for displaying thumbnails, with some modification you could probably make it work how you want. The $cols variable sets the number of columns per row. Substitute your recordset and change the variables and it should work

//START CODE BLOCK
$picturelocsql = "SELECT images.img_id, images.description, images.name, images.location, images.upload_date, albums.album_name FROM images, albums WHERE albums.id = images.album_id AND user_id = " . $_SESSION['SESS_USERID'] . " ORDER BY location ASC;";
$picturelocres = mysql_query($picturelocsql);


echo "<table cellpadding='10'><tr>";
$pos = 0;
$cols = 3;

while ($picloc = mysql_fetch_assoc($picturelocres)) {
$pos++;


$mainpic .= "<td><a href='imageview.php?picid=" . $picloc['img_id'] . "'><img src='pics/" . $picloc['name'] . "' alt='" . stripslashes($picloc['description']) . "... Date: " . date("D F jS, Y", strtotime($picloc['upload_date'])) . "'></a><br />Album: " . $picloc['album_name'] . "</td>";//this is the part you would mod to display your way

if ($pos%$cols === 0 && is_array($picloc)) {
$mainpic .= '</tr><tr>';
}
}
while ($pos%$cols) {
$mainpic .= '<td> </td>';
$pos++;
}
echo $mainpic;
echo "</tr></table>";
}
//END CODE BLOCK
} else {
try something similar in your language
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 06, 2007 Aug 06, 2007
thanks
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 07, 2007 Aug 07, 2007
LATEST
Glad that it worked for you, someone else helped with that bit and so i passed it on to you. The thing a liked about it is you can make the table how ever you want. If you were wondering about the location order by i made it so the user can put 12 thumbnails they choose and change their location on their home page.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines