Hi Matt,

This is for a messaging app.

When users are viewing their inbox, I want a summary of the message to be
displayed. Since this is more of a short messaging system, not an email
client, I'm doing away with 'subject' and just having a message.

The message itself can contain links and some html formatting, such as <b>,
<i>, <img>, etc.

However, when viewing the inbox, not the actual message, I want to present
a summary of the message, in plain text, on one line, and only up to 80
characters. Getting it down to 80 characters is easy left(body,80).

At first though, I was just going to strip out anything between <>  so
whether it was <b> or <LOL> if any content fell between a < and > it would
get stripped out.

This left me thinking that this would strip out an image or link as well.
This could be a problem if someone simply sends a link, as the inbox
summary would just be blank.

So rather than just stripping out everything that fell between < and > I
would try to strip out links and img reference links first..

Make sense?

As an example, say the variable 'message_body' is set to

<p><img alt="" src="
http://i617.photobucket.com/albums/tt257/jasonallen19/298220_801578543388_37707469_38160115_.jpg";
style="width: 614px; height: 502px; " /></p> This is my image. It is
awesome! <b>and this text is bold</b>

I would like to strip it down to.

http://i617.photobucket.com/albums/tt257/jasonallen19/298220_801578543388_37707469_38160115_.jpg
  This is my image. It is awesome! and this text is bold.

And then grab the first 80 characters.

-- 
online documentation: http://openbd.org/manual/
   google+ hints/tips: https://plus.google.com/115990347459711259462
     http://groups.google.com/group/openbd?hl=en

Reply via email to