Help with youtube tags

Discussion in 'PHP' started by x0x, Sep 24, 2008.

  1. #1
    I need them for my site not a forum.

    I found this UBB somewhere:

        array( "#\[youtube\]([a-zA-Z0-9-]+)\[/youtube\]#i", '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/\1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/\1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>' ),
    PHP:
    Can anyone help me transform those for my site?

    bold code for example is works like this in my site:

    $in= str_replace("[b]","<b>", $in);$in= str_replace("[/b]","</b>", $in);
    PHP:
    So the youtube could should be something like that I think..

    They shouldn't be able to link to any other sites than youtube and [a-zA-Z0-9-]
     
    x0x, Sep 24, 2008 IP
  2. Dan Nilsson

    Dan Nilsson Peon

    Messages:
    72
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This should take care of it:

    $in = preg_replace("#\[youtube\]([a-zA-Z0-9-]+)\[/youtube\]#i", '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/\1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/\1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>', $in);
    PHP:
     
    Dan Nilsson, Sep 24, 2008 IP
  3. x0x

    x0x Well-Known Member

    Messages:
    510
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #3
    Didn't work. Didn't even recognize the tags
     
    x0x, Sep 26, 2008 IP