cscampste wrote:
> Can someone explain to me how this segment of code works
please? The part I
> don't understand is how the html tags inside the while
loop are able to
> generate many rows when they are just once and not
contained within php tags. I
> thought I would need something like echo "<tr>" or
need to use printf function
> in order to write the html tags using php. Instead
<tr> and <td> tags are not
> within the <?php /> tags so how can the table be
dynamic and grow and shrink if
> php isn't writing the individual rows on each of the
loops?
It's a common misconception that everything has to be
displayed using
echo. PHP is an embedded language. When the PHP engine sees
an opening
PHP tag it starts parsing the PHP, when it sees a closing
tag, it just
outputs the HTML.
The closing brace of the while loop is after the table row.
It tells the
PHP engine to go back to the top of the loop and to continue
doing so
until the condition is no longer true.
If you study the code generated by Dreamweaver for a repeat
region,
you'll see that it uses the same principle. The only
difference is that
Dreamweaver uses a do... while loop, rather than a simple
while loop.
--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/