PDA

View Full Version : Forum Side Block - Inserting New Line In PHP Code


B16MCC
01-30-2012, 04:10 PM
Hi everyone this one is probably really simple, but it's really buggin me !

I have a forum side block setup to run PHP code. Here's my code below :-
$file = "services_db/DBUK_version.txt";
$f = fopen($file, "r");
while ( $line = fgets($f, 6) ) {
$output = "The Latest Frontend Version Is v" . $line . "\n" . "<a href=http://www.dreamboxuk.com/forums/services_db/frontend.zip> Grab It Here</a>";

return $output;
}


The code is working just fine. It reads the text file and outputs the contents. I then have the link to the file below. I simply want to insert a new line in the output. As you can see I have the "\n" in place but it seems to get ignored completely. Can someone please show me where I'm going wrong.

Thanks a lot gang !

kh99
01-30-2012, 05:00 PM
Since your output is html, you'd need to add '<br />' instead of a newline.

B16MCC
01-30-2012, 06:25 PM
Thanks for the tip, I assumed wrongly it would have to be php code, not HTML.

For reference I added the line

$output = "The Latest Frontend Version Is v" . $line . "<br>" . "<a href=http://www.dreamboxuk.com/forums/services_db/frontend.zip> Grab It Here</a>";

and it works fine. Thanks a lot.