View Single Post
Old 10-14-2003, 11:48 AM   #10 (permalink)
Antagony
Registered User
 
Antagony's Avatar
 
Join Date: Mar 2003
Posts: 31
Antagony is on a distinguished road
Send a message via ICQ to Antagony
Quote:
Originally posted by Nitro
Hmm, I heard that it was best to keep the whole script in php, as it slowed it down or something switching in and out. I'm not sure on this, so perhaps someone could set me straight.
I have also heard this. Not to mention that the code looks less than appealing if you switch back and forth a lot.

Check out the HEREDOC action that was posted above.

Another popular technique to use is to just echo all the HTML, but concatenate successive lines. For example:
PHP Code:
<?
echo "<tr>\n"
   
"<td>$data_one</td>\n"
   
"<td>$data_two</td>\n"
   
"<td>$data_three</td>\n"
   
"</tr>";
?>
... so on and so forth.

But my big question for the example code you posted is why didn't you use a foreach loop?

I guess maybe you can't in your real code, I don't know. Just curious.
Antagony is offline   Reply With Quote