RE: [PHP] mixing HTML and PHP code

From: Date: Fri, 12 Jan 2001 00:40:06 +0000
Subject: RE: [PHP] mixing HTML and PHP code
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-34251@lists.php.net to get a copy of this message
Alex Black ... > yes: > > if you have ever worked in a fast paced production environment, where html > is changed sometimes 5 times a day, digging through hundreds of lines of: > > echo "<input type=\"text\" name=\"hello\" size=\"20\" > value=\"$value\">" > > starts to make you insane. Well, i suggest you to write that kind of lines this way instead: echo "<input type='text' name='hello' size='20' value='$value'>" Works very fine for me, doesn't make any trouble with any browser (as i know so far), and the code is readable. > 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. And yes, i believe that that kind of code is also good. But if you're putting more than one PHP variable into the HTML, i suggest to use the upper piece of code. > : _never_ and I do mean that _never_ use echo for printing html. > > it makes your apps impossible to change, and in a production environment, > that's not ok. > > what if I find a problem in your table code? etc. Well, i still think that using simple quotes is a good readable way...

« previous php.general (#34251) next »