We help IT Professionals succeed at work.
Get Started

Adding a line break in PHP feed output

163 Views
Last Modified: 2016-02-27
Hello

I am trying to edit a feed that is created for my blog extension. I want to place a line break after each tag (there is another problem with the feed and bugs are hard to find when it is all on one line) but I cannot get it to work. I have tried /n but this just outputs /n.

It is not echo so I am not sure this is correct to use. Here is the code

            $output  = '<?xml version="1.0" encoding="UTF-8" ?>';
            $output .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">';

Open in new window


I have tried

            $output  = '<?xml version="1.0" encoding="UTF-8" ?> /n';
            $output .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> /n';

Open in new window


this just outputs

<?xml version="1.0" encoding="UTF-8" ?>/n<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> /n

I have also tried

            $output  = '<?xml version="1.0" encoding="UTF-8" ?>';
			$output  = "\n";
            $output .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">';
			$output  = "\n";

Open in new window


This makes these lines disappear and replaced with a single line break.

Can someone please give me some advice?

Many Thanks
Comment
Watch Question
Consultant
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE