Jump to content

add nl2br to function


Call-911

Recommended Posts

Yes, the above is being echo'd by php. The script works fine, but I need to add nl2br because it's not showing line breaks.

 

ie, if it's stored in the database as:

 

testing sentence one.

testing sentence two.

 

It's displayed as: testing sentence one.testing sentence two.

 

coupe-r's solution didn't work. Not sure why not... in theory it looks like it would work, but the row "overview" wouldn't display when I tried that.

My functions.php file that I include.

<?php 

function fixQuotes($filterString)
{
RETURN  str_replace(chr(133),"...",
		str_replace(chr(241),"&#241;",
		str_replace(chr(150),"-",
		str_replace(chr(145),"'",
		str_replace(chr(146),"'",
		str_replace(chr(146),"'",
		str_replace(chr(147),"\"",			
		str_replace(chr(148),"\"",
		str_replace(chr(133),"&#169;",


		str_replace(chr(198),"'",
		str_replace(chr(246),"",
		str_replace(chr(244),"",

		$filterString))))))))))));
}		



function 
shortVersion($condense)
{
	RETURN substr($condense,0,stripos($condense,"<br"));
}

function 
shortVersion2($condense2)
{
	RETURN substr($condense2,0,stripos($condense2,"\r\n"));
}


function
nodoublespace($removespace)
	{
		RETURN str_replace("  ","",$removespace);
	}

function
single_quote($replacequote)
	{
		RETURN str_replace("'","'",$replacequote);
	}

As long as the code you posted above was working to begin with, this should take care of it.

 

<tr>
<td width='200px' valign='top'>Course Overview: </td>
<td valign='top'> " . nl2br(fixQuotes($row['overview'])) . "</td>
</tr>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.