Jump to content

Recommended Posts

i tried to edit my post, but the time to edit had expired. I got that code from the php docs on php.net. I was hoping to figure out a way to leaving in the whitespace, so that the html looks nicer when displayed, but I haven't figured it out.

Also keep in mind the PHP files your accessing are post-parsed. Any PHP in the file will return just as plain HTML since PHP is operated server side.

 

And yeah I also think your looking for nl2br() but just incase that doesn't work keep in mind you can always cheat and do something like

 

$file = str_replace( " ", "<WHITE>", $file );

 

process your file

 

$file = str_replace ( "<WHITE>", " ", $file );

 

This basically transforms the white space to data PHP won't touch, then transforms it back again. Haven't tested it, but I don't see why it wouldn't work.

I couldn't figure out how to do it with file_get_contents() and still have the appropriate whitespace and line breaks. I did however provide a good solution to the original question, so maybe somebody else can come up with another way or a better way and share. I'm still a php newbie!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.