Heath Posted June 3, 2008 Share Posted June 3, 2008 I have a video sitemap that is including br's in my description and giving me error messages on google. Is there a way to use one of these lines to remove the </ br> Here are the 2 lines of code i have been playing with to remove them. This is all I have so far. $description = str_replace("´", "", $row['description']); $description = preg_replace('/&(?!(#[0-9]+|[a-z]+);)/si', '&', $description); Link to comment https://forums.phpfreaks.com/topic/108466-using-php-to-remove-brs/ Share on other sites More sharing options...
teng84 Posted June 3, 2008 Share Posted June 3, 2008 can we see a sample strings that you're trying to work out maybe you can try <a href="http://www.php.net/manual/en/function.strip-tags.php"> stiptags </a> Link to comment https://forums.phpfreaks.com/topic/108466-using-php-to-remove-brs/#findComment-556124 Share on other sites More sharing options...
Heath Posted June 3, 2008 Author Share Posted June 3, 2008 <url> <loc>http://mydomain.com/index.php?ind=media&op=file_view&iden=281656</loc> <video:video> <video:title>How to Make Fire Balls! Really Cool!</video:title> <video:description>How to make fireballs that you can hold in your hands. Be careful though, it's still fire and can still burn you. Found this vid and thought it was cool.<br /></video:description> <video:thumbnail_loc>http://mydomain.com/mkportal/modules/media/pics/mk_281656.jpg</video:thumbnail_loc> </video:video> </url> That is one of the video sitemap outputs that has a <br / > in it that continues to cause problems. There are over 100+ that also have this problem. So its imperative I get it worked out using php or else it is a lot of manual labor. Link to comment https://forums.phpfreaks.com/topic/108466-using-php-to-remove-brs/#findComment-556127 Share on other sites More sharing options...
DarkWater Posted June 3, 2008 Share Posted June 3, 2008 $text = str_replace("<br />", "", $text); Link to comment https://forums.phpfreaks.com/topic/108466-using-php-to-remove-brs/#findComment-556128 Share on other sites More sharing options...
Heath Posted June 3, 2008 Author Share Posted June 3, 2008 DarkWater can u wrap that in the code thing so I can see it all please? Thank you very much! Link to comment https://forums.phpfreaks.com/topic/108466-using-php-to-remove-brs/#findComment-556130 Share on other sites More sharing options...
teng84 Posted June 3, 2008 Share Posted June 3, 2008 $text = str_replace("<br />", "", $text); @ health can we see your code so we can modify it Link to comment https://forums.phpfreaks.com/topic/108466-using-php-to-remove-brs/#findComment-556131 Share on other sites More sharing options...
DarkWater Posted June 3, 2008 Share Posted June 3, 2008 I edited my post and used code tags so the BR didn't actually line break, lol. Link to comment https://forums.phpfreaks.com/topic/108466-using-php-to-remove-brs/#findComment-556132 Share on other sites More sharing options...
Heath Posted June 3, 2008 Author Share Posted June 3, 2008 Awesome, that worked! How ever now there is no space between things that had a br.... any way to add a space or something? Here is my what I am editing.. while ($row = $DB->fetch_row($query)) { $id = $row['id']; $name = str_replace("´", "", $row['name']); $name = preg_replace('/&(?!(#[0-9]+|[a-z]+);)/si', '&', $name); $description = str_replace("<br />", "", $row['description']); $description = preg_replace('/&(?!(#[0-9]+|[a-z]+);)/si', '&', $description); $pic = $row['pic']; $content .= " Link to comment https://forums.phpfreaks.com/topic/108466-using-php-to-remove-brs/#findComment-556156 Share on other sites More sharing options...
DarkWater Posted June 3, 2008 Share Posted June 3, 2008 $description = str_replace("<br />", " ", $row['description']); Link to comment https://forums.phpfreaks.com/topic/108466-using-php-to-remove-brs/#findComment-556162 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.