![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Unverified User
Join Date: Aug 2005
Location: none
Posts: 146
Rep Power: 0
![]() |
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"?> <!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> test 1<br/> test 2 </body> </html> instead of <?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"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>testing PHP</title> </head> <body> test 1<br/> test 2 </body> </html>
__________________
Warning: My posts may change (dramatically) within the first 15 minutes they're posted. Got 'Nux?—GNU/Linux and other free software support. It's GNU/Linux, not just Linux. |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 | |
|
Unverified User
Join Date: Aug 2005
Location: none
Posts: 146
Rep Power: 0
![]() |
Quote:
__________________
Warning: My posts may change (dramatically) within the first 15 minutes they're posted. Got 'Nux?—GNU/Linux and other free software support. It's GNU/Linux, not just Linux. |
|
|
|
|
|
|
#4 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
![]() 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]
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#5 |
|
Hobbyist Programmer
|
echo("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n");
echo("test 1<br />\n");
echo("test 2\n");there is a space between <br/>. should be this <br /> |
|
|
|
|
|
#6 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Nonsense.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#7 |
|
Hobbyist Programmer
|
that is what it shows on the tutorial i have read http://www.w3schools.com/php/php_functions.asp
|
|
|
|
|
|
#8 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
There's nothing wrong with "<br />". There's nothing wrong with "<br/>". I realize you are not misleading people intentionally.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#9 |
|
Hobbyist Programmer
|
so they mean the samethin with or without the space.
|
|
|
|
|
|
#10 | |
|
Unverified User
Join Date: Aug 2005
Location: none
Posts: 146
Rep Power: 0
![]() |
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]
__________________
Warning: My posts may change (dramatically) within the first 15 minutes they're posted. Got 'Nux?—GNU/Linux and other free software support. It's GNU/Linux, not just Linux. |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|