+ Reply to Thread
Results 1 to 3 of 3
Like Tree2Likes
  • 2 Post By sikuneh

Thread: User Submission Video Embed Parse HTML tags

  1. #1
    sikuneh is offline x10Hosting Member sikuneh is an unknown quantity at this point
    Join Date
    Dec 2008
    Posts
    43

    User Submission Video Embed Parse HTML tags

    I have a user submission site and I want to allow them to embed videos, currently I just let them paste the embed code but I have no way of getting rid of HTML tags that would mess up the CSS (I.E. adding a div without closing it). Is there a good way to fix this?
    dinomirt96 and karimirt47 like this.

  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: User Submission Video Embed Parse HTML tags

    Having users enter HTML is unnecessary for you and adds needless complexity for them. The safest approach would be to let users enter only the video URL, height and width. If need be, have different templates for different video hosts.

    If you still wish to allow HTML, you could use strip_tags (which might have some problems with long tags), however it doesn't filter out attributes (which you could then do by parsing the string using one of the XML manipulation extensions). For a more complete solution, try HTML Purifier.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  3. #3
    sikuneh is offline x10Hosting Member sikuneh is an unknown quantity at this point
    Join Date
    Dec 2008
    Posts
    43

    Re: User Submission Video Embed Parse HTML tags

    I was also thinking about how forums use brakets to parse html.

    E.G. [font color=] = <span style="font-color:">

    How does that work? I assume it uses preg_replace() or something? Or would using brackets be too complicated?

    My thought was [video url=] = <iframe src=> or <embed>. would that work?
    Last edited by sikuneh; 02-02-2011 at 08:15 PM.

+ Reply to Thread

Similar Threads

  1. Custom HTML Tags, Good Idea?
    By ZharkD in forum Programming Help
    Replies: 2
    Last Post: 03-07-2010, 02:29 PM
  2. PHP And HTML Div Tags
    By masterjake in forum Programming Help
    Replies: 5
    Last Post: 10-22-2008, 02:00 AM
  3. html tags - help anyone?
    By ispital in forum Programming Help
    Replies: 15
    Last Post: 05-02-2008, 06:51 AM
  4. HTML tags
    By callumacrae in forum Crossfire
    Replies: 21
    Last Post: 02-20-2008, 11:39 AM
  5. PHP remove html/other uncessary tags? - need help
    By a-a-a in forum Scripts & 3rd Party Apps
    Replies: 8
    Last Post: 10-30-2007, 07:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers