![]() |
autoindention
Is there a way I can get PHP to automatically correctly indent something? For example, make
[php]<?php echo("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n");?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>testing PHP</title> </head> <body> <?php echo("test 1<br/>\n"); echo("test 2\n"); ?> </body> </html>[/php] output :
<?xml version="1.0" encoding="iso-8859-1"?>instead of :
<?xml version="1.0" encoding="iso-8859-1"?> |
PHP is echoing precisely what you told it to. If it did otherwise, you'd probably like it less. Since the PHP isn't in force when you established your pattern, how's it to know? You'd have as much right expecting the renderer or the server to handle it, which is little to none.
|
Quote:
|
:confused:
This is what your PHP interpreter works with: [php]echo("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"); echo("test 1<br/>\n"); echo("test 2\n"); [/php] |
:
there is a space between <br/>. should be this <br /> |
Nonsense.
|
that is what it shows on the tutorial i have read http://www.w3schools.com/php/php_functions.asp
|
There's nothing wrong with "<br />". There's nothing wrong with "<br/>". I realize you are not misleading people intentionally.
|
so they mean the samethin with or without the space.
|
Quote:
My PHP interpreter starts with: [php] echo("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?> <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> <!--This file was generated by PHP. For the source of the PHP functions used, see common.txt on the top level of the server.--> <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\"> <head> <title>$title</title> <link media=\"all\" rel=\"stylesheet\" type=\"text/css\" href=\"/css/all.css\"/> <link media=\"screen,projection\" rel=\"stylesheet\" type=\"text/css\" href=\"/css/LightOnDark.css\"/> </head> <body>\n");[/php] |
| All times are GMT -5. The time now is 10:48 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC