Strip HTML fromMeta Description

I want to use copy from my database for the meta description.

Problem is that because there's link breaks, paragraphs and links in the copy it's not really working. Do you know how I could strip the copy of all of this and just show the text?

This is the php I use to call the text...

<meta name="description" content="<?php echo $row_Recordset1['copy']; ?>">

I could also do with limits the text to 200 characters.
BrighteyesDesignAsked:
Who is Participating?
 
Ray PaseurConnect With a Mentor Commented:
Maybe something like this:
<meta name="description" content="<?php echo substr(strip_tags($row_Recordset1['copy']),0,200); ?>">

Open in new window

Obviously since I do not have your data I cannot test it.  Key functions to apply in order:
http://php.net/manual/en/function.strip-tags.php
http://php.net/manual/en/function.substr.php
0
 
BrighteyesDesignAuthor Commented:
Perfect, cheers Ray!
0
 
Ray PaseurCommented:
Thanks for the points! ~Ray
0
All Courses

From novice to tech pro — start learning today.