Hi,
http://bit.ly/9TYQW7
The above link is an example for a problem. If you see the source, the description is not good. But i don't know how to remove the new line.
* While i insert the data in mysql, i didn't use any formatting.
* tried nl2br and then tried to remove br
* tried \n to space
But the description still have new line.
Dynamic Description New Line Problem
Moderator: General Moderators
Re: Dynamic Description New Line Problem
I'm assuming you're referring to the blank line between "by Charlie Chaplin" and "Mirror is..."? There are definitely two line breaks in there. If you're sure they aren't in the database, then I'd look at the code where the SQL results are being echoed/printed.
Re: Dynamic Description New Line Problem
In DB
It has two line breaks.
This is the following code for description
It has two line breaks.
This is the following code for description
Code: Select all
$description = str_replace('\n',"",$description);
$description = substr($description, 0, 100);Re: Dynamic Description New Line Problem
If the line breaks are in the DB, you'd want to replace <br>, not \n
Re: Dynamic Description New Line Problem
I tried the following
But still i have that problem
Code: Select all
$description = str_replace('<br />',"",$description);
$description = str_replace('<br>',"",$description);Re: Dynamic Description New Line Problem
I tried this too
But not working 
Code: Select all
$description = nl2br($description);
$description = str_replace('<br />',"",$description);
$description = str_replace('<br>',"",$description);Re: Dynamic Description New Line Problem
As a quick fix i did like this
But i am not satisfied with this method.
Please let me know some good method
Code: Select all
$description_arr = explode(" ",$description);
$description = '';
foreach($description_arr as $meta_d){
$description .= trim($meta_d)." ";
}Please let me know some good method