Forums

PHP

This topic is locked

Horizontal Loop

Posted 31 Jul 2001 18:28:45
1
has voted
31 Jul 2001 18:28:45 Keith Slater posted:
I can get the horizontal loop to work but is tehir a way to use it so that it loops into different cells in a table? Right now the pictures are sitting right next to each other. but I'd like them to sit in TD cells right next to eachother then after 3 go down to a new TR.

thanks again

Keith Slater
Word Pro Systems
www.wordprosys.com

Replies

Replied 31 Jul 2001 19:52:41
31 Jul 2001 19:52:41 Tim Green replied:
You would have to manually code this. However it should be relatively easy as the code will be very similar to that of the Horizontal Looper code itself.

Your best bet would be to apply the Horizontal Looper, and then play around with the code.

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 01 Aug 2001 20:15:46
01 Aug 2001 20:15:46 Keith Slater replied:
I've been messing with the code and I can't get nothing to happen. I realize it should be easy but I just can't get it...

Keith Slater
Word Pro Systems
www.wordprosys.com
Replied 01 Aug 2001 22:12:34
01 Aug 2001 22:12:34 Tim Green replied:
You should be looking for something in this kind of format :-

&lt;table&gt;
&lt;?php while (!$Recordset-&gt;EOF) { ?&gt;
&lt;tr&gt;
&lt;?php for ($k=0; $k &lt; 3; $k++) { ?&gt;
&lt;td&gt;&lt;?php echo $Recordset-&gt;Fields("PICTURE"; ?&gt;&lt;/td&gt;
&lt;?php
$Recordset-&gt;MoveNext();
}
?&gt;
&lt;/tr&gt;
&lt;?php
}
?&gt;
&lt;/table&gt;

You will probably need to tweak this code a little, but I hope it puts you on the right track

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 09 Aug 2001 15:01:03
09 Aug 2001 15:01:03 Keith Slater replied:
this is the code I got now:

table&gt;
tr&gt;
?php while (($Repeat1__numRows-- != 0) && (!$Recordset1-&gt;EOF))
{
?&gt;
td width=173&gt;
div align="center"&gt;a href="large.php?art=&lt;?php echo $Recordset1-&gt;Fields("PICTURE_NAME"?&gt;"&gt;img src="images/&lt;?php echo $Recordset1-&gt;Fields("PICTURE_NAME"?&gt;" width="150" height="150" border="0"&gt;&lt;/a&gt;&lt;br&gt;
a href="vprofile.php?artist=&lt;?php echo $Recordset1-&gt;Fields("USER_NAME"?&gt;"&gt;
?php echo $Recordset1-&gt;Fields("ARTIST_NAME"?&gt;
&lt;/a&gt;&lt;/div&gt;
&lt;/td&gt;
?php
$Repeat1__index++;
$Recordset1-&gt;MoveNext();
}
?&gt;
/tr&gt;
/table&gt;

I've been trying the ?php for ($k=0; $k &lt;3; $k++){?&gt;
and changing stuff around but I cant get it to work.

thanks for the help

Keith Slater
Replied 09 Aug 2001 16:42:30
09 Aug 2001 16:42:30 Tim Green replied:
OK. Please stick to this thread, the other thread will be locked to prevent confusion.

Try this code :-

&lt;table border="0"&gt;
&lt;?php while (($Repeat3__numRows-- != 0) && (!$Recordset3-&gt;EOF)) { ?&gt;
&lt;tr&gt;
&lt;td width="173"&gt;
&lt;?php
$theLoop=0;
while (($theLoop &lt; 3) && (!$Recordset3-&gt;EOF)) {
$theLoop++;
?&gt;
&lt;div align="center"&gt;
&lt;img src="images/&lt;?php echo $Recordset3-&gt;Fields("PICTURE_NAME"?&gt;" width="150" height="150"&gt;
&lt;br&gt;
&lt;a href="vprofile.php?arist=&lt;?php echo $Recordset3-&gt;Fields("USER_NAME"?&gt;"&gt;
&lt;?php echo $Recordset3-&gt;Fields("ARTIST_NAME"?&gt;
&lt;/a&gt;
&lt;/div&gt;
&lt;?php
$Recordset3-&gt;MoveNext();
}
?&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;?php
$Repeat3__index++;
$Recordset3-&gt;MoveNext();
}
?&gt;
&lt;/table&gt;

I would recommend that you read through the PHP Manual (PDFs available at www.php.net) and learn about looping techniques.

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 09 Aug 2001 16:59:09
09 Aug 2001 16:59:09 Keith Slater replied:
thank you sooo much tim, it worked. I really appreciate it

Keith Slater
Replied 09 Aug 2001 17:22:44
09 Aug 2001 17:22:44 Tim Green replied:
Glad I can be of help Keith ! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>

Reply to this topic