RE: [PHP] mixing HTML and PHP code

From: Date: Fri, 12 Jan 2001 16:32:31 +0000
Subject: RE: [PHP] mixing HTML and PHP code
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-34256@lists.php.net to get a copy of this message
Philip Olson ... > 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>"); I'd suggest: echo "<table bgcolor='#ffffff'> <tr> <td bgcolor='eeeeee' width='300'> Name : "; $name = 'johnny'; echo "<B>$name</B> </td> <td bgcolor='#eeeeee' width='300'> Title : "; $title = 'smith'; echo"<B>$title</B> </td> </tr> </table>"); This way, the code IS readable, for small-medium size echoing.

« previous php.general (#34256) next »