cleaning up some output

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Vegan
Forum Regular
Posts: 539
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC

cleaning up some output

Post by Vegan »

el code

so I wanted to have each item on a new line

Code: Select all

echo '<strong>IP Address</strong>:- '.$ip;;
echo '<strong>City</strong>:- '.$city;  
echo '<strong>Country</strong>:- '.$country;  
echo '<strong>Country Code</strong>:- '.$country_code;
echo '<strong>Currency Code</strong>:- '.$currency_code;  
echo '<strong>Latitude </strong>:- '.$latitude;  
echo '<strong>Longitude </strong>:- '.$longitude;  
echo '\n\l' does not work, do does <br> etc etc

using a php plugin to add snippets
User avatar
Christopher
Site Administrator
Posts: 13592
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: cleaning up some output

Post by Christopher »

HTML line breaks:

Code: Select all

echo '<strong>IP Address</strong>:- '.$ip . '<br>';
echo '<strong>City</strong>:- '.$city . '<br>';  
echo '<strong>Country</strong>:- '.$country . '<br>';  
echo '<strong>Country Code</strong>:- '.$country_code . '<br>';
echo '<strong>Currency Code</strong>:- '.$currency_code . '<br>';  
echo '<strong>Latitude </strong>:- '.$latitude . '<br>';  
echo '<strong>Longitude </strong>:- '.$longitude . '<br>';  
(#10850)
User avatar
Vegan
Forum Regular
Posts: 539
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC

Re: cleaning up some output

Post by Vegan »

I tried that and it seems that WP does not accept the line breaks properly. I have also tried PHP_EOL etc.

Wonder if I need to do something more?
User avatar
Vegan
Forum Regular
Posts: 539
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC

Re: cleaning up some output

Post by Vegan »

curious after adding echo $nbsp; which did not render, removing it seems to have fixed it, bizzare effect
User avatar
Vegan
Forum Regular
Posts: 539
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC

Re: cleaning up some output

Post by Vegan »

after a few updates it seems to be working fine now, wonder if there was something wrong in wordpress....
User avatar
Christopher
Site Administrator
Posts: 13592
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: cleaning up some output

Post by Christopher »

Well, at least it is working now...
(#10850)
Post Reply