Re: mixing HTML and PHP code

From: Date: Fri, 12 Jan 2001 09:53:34 +0000
Subject: Re: mixing HTML and PHP code
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-34224@lists.php.net to get a copy of this message
You know what's annoying? This (yes, it happens) : echo ("<table bgcolor=\"#ffffff\">"); echo ("<tr>"); echo ("<td bgcolor=\"#eeeeee\" width=\"300\">"); print("Name :"); $name = 'johnny'; printf("%s %s %s","<b>","$name","</b>"); echo ("</td>"); echo ("<td bgcolor=\"#eeeeee\" width=\"300\">"); print("Title :"); $title = 'smith'; printf("%s %s %s","<b>","$title","</b>"); echo("</td>"); echo("</tr>"); echo("</table>"); Coding standards are being created (via PEAR) and a few recent articles exist but point is we're teaching differently, everywhere. PHP is loose as a goose! print 'foo'; print("foo"); print "foo"; printf("%s","foo"); ... all being taught, all being read, all being (mis)used. Am looking forward to the in-progress PEAR Standards, which can partially be seen here : http://marc.theaimsgroup.com/?l=php-pear&m=97603413001842&w=2 Once this comes about we'll start teaching _GOOD_ coding techniques and after awhile many more will become pretty little coders writing (and copying) pretty little recognizable scripts. Looking forward to it. Looking forward to picking up a PHP book and seeing concepts shown through standards and not through the authors preferred style at the moment. This is especially true regarding articles/tutorials. Learn the standards first! Then you may be free to roam about the isles. Go here, be sure to sift through the user comments : Best Practices: PHP Coding Style : http://phpbuilder.com/columns/tim20010101.php3 Smart Architectures in PHP : http://phpbuilder.com/columns/tim20001010.php3 A few humble thoughts. Happily yours, Philip On Fri, 12 Jan 2001, Alexander Wagner wrote: > Alex Black wrote: > > echo "<input type=\"text\" name=\"hello\" > > size=\"20\" > > value=\"$value\">" > > > > starts to make you insane. > > If it is done wrong spread over the whole project hidden between lines > of PHP-code, it sure does. > > > speaking as an html author, and a lover of php, _please_: > > > > <input type="text" name="hello" size="20" > > value="<?=$value?>"> > > > > it makes the code useable. > > No. > > <input type="text" name="hello" size="20" > value="{value}"> > > makes the code usable, and your HTML can even be edited with a > graphical HTML-editor. > > There is no reason to mix up HTML and PHP, except for very small > projects. > > regards > Wagner > > -- > Sanity is calming, but madness is more interesting. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#34224) next »