Forum Moderators: coopster
I have tried to retrieve a value of the database and used it on the Meta Description of my site. My problem here is that the string appears to break lines.
Example:
-----------------------------------------
<meta description="the quick brown
fox jumped
over the lazy dog">
-----------------------------------------
And I want it to appear this way:
<meta description="the quick brown fox jumped over the lazy dog">
Is there a function that can solve this?
Thanks and hope to hear from someone soon! :-)
Example:
-----------------------------------------
<meta name="description" content="the quick brown
fox jumped
over the lazy dog">
-----------------------------------------
And I want it to appear this way:
<meta name="description" content="the quick brown fox jumped over the lazy dog">
/*From the database you get your meta description text*/
$metatext=$thisrecord['meta_description'];
$metatext=htmlspecialchars(str_replace("\n", "", str_replace("\r", "", $metatext)));
/*The htmlspecialchars is primarily there to change quotes to char entities so they won't prematurely close the meta tag. The two str_replace() functions get rid of the returns/newlines*/
<meta name="description" content="<?php echo $metatext;?>">