Jump to content

How do i not remove the spaces?


Wes1890

Recommended Posts

I've got a CMS system on my site... and last nite before I went to bed, i posted myself a reminder to do something bla bla bla... well, posted something like this:

 

Well i'm off to bed...            it's 3:20am!

 

This is also a reminder to FIX THE MEMCP FILE!!

 

well, the problem is, it shows up like this:

Well i'm off to bed... it's 3:20am! This is also a reminder to FIX THE MEMCP FILE!!

 

It removes the "newlines" and the multiple spaces.... how would i have it keep them?

 

Big thanks

Link to comment
Share on other sites

The original message is this:

bla bla bla bla bla

 

poo

 

The <pre> idea works, but disables the word wrap that the browser has default...

 

Using <b>strtr()</b> i replaced all spaces with <b> </b> and replaces all lines with <br />... but the message came out something like this:

bla&bla&bla&bla&bla

 

So, for the lines i put

$message_line = strtr($message,"","

");

 

Which made

bla bla bla bla bla

poo

(poo only went down 1 line.. instead of the original 2)

 

 

Thanks for the reply... but any more ideas?

Link to comment
Share on other sites

I knew there was a string replace function.... but i used strreplace by mistake... thanks a bunch..

 

 

But now there is another problem (figures...)

 

The text inside the tables do not wrap, even when i shrink the width of the tables.

 

Is there a way to wrap text? Or is there a way to count an amount of characters (length) and have it make a new line after there are so many letters? (without cutting words in half)

 

^Big thanks to you man.. but what about word wrapping?

Link to comment
Share on other sites

It isn't working for some reason... ???

 

This is the code ($message is what needs wrapped... also, language filter is my own function, just ignore it)

// Display the news

while($r=mysql_fetch_array($getnews))

{

  extract($r); // Put DB info as VARS

  $title = stripslashes($title); // Strip slashes

  $message = stripslashes($message); // Strip slashes

  $message_line = str_replace(' ',' ',nl2br($message)); // Make new lines

  $message_clean = language_filter($message_line); // Filter the language

  $message_wrap = wordwrap($message_clean, 20, "<br />\n"); // Wrap the message

  $final_message = $message_wrap; // The final piece

 

  echo "Message: {$final_message}";  // Show the message

}

 

 

Why wont it work?

Link to comment
Share on other sites

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.