Well its like anything else, its personal preference and who your talking too, this is standard coding pratice offered by our development firm, and I have continued the practice. To be honest, you should almost never have logic code contained on the same page as your presentation code. I have never run into a problem with people saying that they are seeing lags or such, but then again that could just be because the code that is on those pages is compact. Most ASP people and JSP I know do it either this way for most of their code, there is some minor for loops or if statments in the HTML code, either that or the have functions and class stored elsewhere.
dan --- Mike Eheler <[EMAIL PROTECTED]> wrote: > The problem with that is giving feedback to the user. If you're busy > generating a string to display to the user and the mysql server is > running slow, or for whatever reason, the user is looking at a blank > page until the process is completed entirely, then they have all the > data dumped on them at once. > > For someone on a modem, this is a bad thing, because first they're > waiting for the page to be created, then they're waiting for the data to > download. > > I've always been taught by people who have been working in this industry > for years (even back in my ASP days) that it's always best to send data > to the user's browser as soon as possible. > > Mike > > Dan McCullough wrote: > > > Here is one thing that I do, of course there is 50 ways you can do anything. > > All coding, well 90% of the PHP is done in the head, all output in coposed in >variables, and > > outputted through the code. All SQL is done there as well, and an mysql close is >done at the > end > > of that area. If there is any logic in the where the html is, its smallish if >else statments. > > > > Small example. > > <? > > all php logic. > > $sql = ""; > > $cat_output = "<table><tr>" > > while ($category = mysql($result)) { > > $cat_output .= "<td>".$category['name']."</td>"; > > } > > $cat_output = "</tr></table>" > > $sql = ""; > > if () { > > $subcat_output .= ""; > > } else { > > $subcat_output .= ""; > > } > > $sql = ""; > > $sql = ""; > > $sql = ""; > > mysql_close(); > > ?> > > > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> > > > > <html> > > <head> > > <title>Untitled</title> > > </head> > > > > <body> > > > > <?print $cat_output; ?> > > > > </body> > > </html> > > > > > > Something a little like that > > > > > > > > --- René_Fournier <[EMAIL PROTECTED]> wrote: > > > >>Is it true that mixing HTML and PHP--switching back and forth with > >><?php ?> tags--slows down performance? (I'm using PHP4.) Is it better > >>to echo output than to drop out of PHP mode? > >> > >>And concerning database connections, my ISP asks that I always close a > >>MySQL connection with a mysql_close()--which I can understand. But I'm > >>curious, if I have to make, say, 10 SELECTs throughout a page (in the > >>header, body, and footer), is it perhaps faster to use the mysql_close() > >>at the very end of the page (in the bottom of the footer.inc)? In other > >>words, is there any disadvantage performance-wise (or stability reason) > >>to open and immediately thereafter close mysql connections? > >> > >>Can anyone recommend an article or two on coding techniques for > >>improving PHP and MySQL performance? I don't wan to spend the rest of my > >>life optimizing my php code, but if I knew a few basic rules about its > >>performance characteristics, I might be able to make better decisions > >>when coding. Thanks. > >> > >>...Rene > >> > >>--- > >>René Fournier, > >>[EMAIL PROTECTED] > >> > >> > >>-- > >>PHP General Mailing List (http://www.php.net/) > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>For additional commands, e-mail: [EMAIL PROTECTED] > >>To contact the list administrators, e-mail: [EMAIL PROTECTED] > >> > >> > > > > > > __________________________________________________ > > Do You Yahoo!? > > Check out Yahoo! Shopping and Yahoo! Auctions for all of > > your unique holiday gifts! Buy at http://shopping.yahoo.com > > or bid at http://auctions.yahoo.com > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > __________________________________________________ Do You Yahoo!? Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]