• 0

PHP script help


Question

Hello,

I am trying to create a Script that will grab the checks from Pingdom and output them into a page on my website http://oswestryweather.co.uk/station-status/, i have got the script to grab the checks from Pingdom and print them onto the page however for some reason they won't display on a seperate line, the script i am using can be found here http://pastie.org/2187445

Does anyone know why this might not be puitting all my outputs onto sepearate lines?

Thanks

Richard

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

Well, it is inserting the newlines in your code, if you look at the source it looks like this:


Website & Account Centre is down
Server 1 is up
Server 2 is up
Server 3 is up
[/CODE]

What you need is a <br> tag to actually separate it in display.

Link to comment
Share on other sites

  • 0

Well, it is inserting the newlines in your code, if you look at the source it looks like this:


Website & Account Centre is down
Server 1 is up
Server 2 is up
Server 3 is up
[/CODE]

What you need is a <br> tag to actually separate it in display.

Well that is interesting, where would i put the BR code in the PHP file to get it to display correctly? If i just go ahead and add <br /> into the php it will error won't it.

Link to comment
Share on other sites

  • 0

Exactly. Newlines (and PHP_EOL constant, actually, to be consistent among platforms) are for working with text files. Tags are required for browser output.

But please use <br /> if this is going into production somewhere - gotta have standards, you know :)

print "Error: " . $response['error']['errormessage'] . '&lt;br /&gt;';

Link to comment
Share on other sites

  • 0

But please use <br /> if this is going into production somewhere - gotta have standards, you know :)

Well, if the standard is HTML, not XHTML, then <br> is fine. ;)

Link to comment
Share on other sites

  • 0

Exactly. Newlines (and PHP_EOL constant, actually, to be consistent among platforms) are for working with text files. Tags are required for browser output.

But please use <br /> if this is going into production somewhere - gotta have standards, you know :)

print "Error: " . $response['error']['errormessage'] . '&lt;br /&gt;';

+Pouchg you are a star, that has solved it. I wounder why

/n[/CODE]

wasn't working? Does it not work on [u][b]ALL[/b][/u] browsers?

Link to comment
Share on other sites

  • 0

+Pouchg you are a star, that has solved it. I wounder why

/n[/CODE]

wasn't working? Does it not work on [u][b]ALL[/b][/u] browsers?

It was working, it's just if you write

a paragraph

like this

in HTML

the web browser doesn't care, and puts it all on one line.

Link to comment
Share on other sites

  • 0

I still might be acting really thick here, according to the php manual /n is for creating new lines, from my understanding after posting here this is only for creating new lines in a text output? If i want a browser to render the line break i need to specify that with < br /> is that correct?

Link to comment
Share on other sites

  • 0

I still might be acting really thick here, according to the php manual /n is for creating new lines, from my understanding after posting here this is only for creating new lines in a text output? If i want a browser to render the line break i need to specify that with < br /> is that correct?

yes

Link to comment
Share on other sites

  • 0

I still might be acting really thick here, according to the php manual /n is for creating new lines, from my understanding after posting here this is only for creating new lines in a text output? If i want a browser to render the line break i need to specify that with < br /> is that correct?

Yes, and if you want your code to render with breaks, you'd use both \n and <br>

Link to comment
Share on other sites

This topic is now closed to further replies.