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

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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