Jump to content

Using php to remove BRs


Heath

Recommended Posts

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

<url>
<loc>http://mydomain.com/index.php?ind=media&op=file_view&iden=281656</loc>
<video:video>
<video:title>How to Make Fire Balls&#33; Really Cool&#33;</video:title>
<video:description>How to make fireballs that you can hold in your hands. Be careful though, it&#39;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.

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 .= "

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.