SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist silversurfer5150's Avatar
    Join Date
    Aug 2010
    Posts
    534
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Php Strip Html Tags

    Hi there,

    I am making some mods to an E-Commerce CMS (opencart) and one of them requires that there must be no html tags in the product description field.

    This works fine when the products are first uploaded in the db but if you try to modify it in to back office there is a text editor which adds html tags unless you tell it not to by changing it to plain text mode. This can lead to things like:

    <img src="<p>picture.jpg</p>" /> // I am wrapping the img tags around the description dynamically

    There is no way around this, it is just how my modification works so I need to ensure that if the user does happen to forget to select plain text mode when editing in the back office, the html tags are stripped before it wraps the img tags around the source name.

    What is the best way to strip these tags?
    "Persistence is the path to perfection"

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,509
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)

  3. #3
    SitePoint Evangelist silversurfer5150's Avatar
    Join Date
    Aug 2010
    Posts
    534
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Guido
    "Persistence is the path to perfection"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •