Jump to content

Help with function and breakline output


EchoFool

Recommended Posts

I have a problem with my script. I input data using a function to maintain its line structure...

 

This part works fine...

$QuoteMessage = nl2br($row['Message']);
$UPDATE2 = mysql_query("INSERT INTO posts (ThreadID,UserID,Message,CreatedOn)
			VALUES ('$Thread','{$_SESSION['Current_User']}','$Post','$Date')")
				Or die(mysql_error());

 

How ever if i want to echo it with my function involved i get this:

 

Test<br /> test<br /> <br /> <br /> <br /> Test<br /> Test<br /> e<br /> <br /> tete<br /> w000

 

 

This is how it should look

Test<br /> test<br /> <br /> <br /> <br /> Test<br /> Test<br /> e<br /> <br /> tete<br /> w000

 

As you can see its not doing the lines but its echo'in the actual layout html code.

 

 

This is what i have for my output:

 

<?php
function BBCode($BB){
				$BBCode = array("&" => "&",
					"<" => "<",
					">" => ">",
					"[b]" => "<b>",
					"[/b]" => "</b>",
					"[i]" => "<i>",
					"[/i]" => "</i>",
					"[u]" => "<u>",
					"[/u]" => "</u>",
					"[Quote]" => "<div class='quotetop'>QUOTE</div><div class='quotemain'>",
					"[quote]" => "<div class='quotetop'>QUOTE</div><div class='quotemain'>",
					"[quote]" => "<div class='quotetop'>QUOTE</div><div class='quotemain'>",
					"[/Quote]" => "</div><br>",
					"[/quote]" => "</div><br>",
					"[/quote]" => "</div><br>",
					"[sQ]" =>  "<div class='quotetop'>QUOTE <span class=PositiveMoney> ",
					"[sQ2]" => "</span></div><div class='quotemain'>",
					"<br />" => "",);

				$Message = str_replace(array_keys($BBCode), array_values($BBCode), $BB);
			return $Message;
								}
//query get message stuff here

//------------------------

$newString = BBCode($Message);
			$newString = str_replace('<br />', '', $newString);
			echo $newString;?>

What did i do wrong?

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.