Custom Tags

pnikosis - January 17, 2007 - 10:59
Project:Bbcode
Version:5.x-1.x-dev
Component:BBCode Tags
Category:feature request
Priority:minor
Assigned:naudefj
Status:closed
Description

Is there a way to create custom bbcode tags? Thanks!

#1

naudefj - January 18, 2007 - 08:24
Priority:normal» minor
Assigned to:Anonymous» naudefj

Unfortunately not (see the TODO section of the README file).

What tags do you want to add?

#2

pnikosis - January 18, 2007 - 09:08

For example, a youtube tag, like [youtube]Y70aJn7fb9Q[/youtube] or using it with the Hovertips module for [Hover="hover this"]some text[/hover] :)

Great module by the way, I love it :)

#3

naudefj - January 18, 2007 - 09:44

If you send me the HTML for these tags I will send you the code.

#4

pnikosis - January 18, 2007 - 14:03

Thanks a lot, for example for youtube:

<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/Y70aJn7fb9Q"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/Y70aJn7fb9Q" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>

Where Y70aJn7fb9Q is the movie ID

For Google Video:

<embed style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash"
src="http://video.google.com/googleplayer.swf?docId=-3636478429299171266&hl=en"></embed>

Where 3636478429299171266 is the movie ID

(I prefer using this than the video module, because this way I can let users in the forums post videos with bbcode)

Or in the case for the hovertips and clicktips plugin (http://drupal.org/project/hovertip):

<div>This is something you can click on to make a tooltip appear</div>
<div class="clicktip">This is the HTML that will appear when clicked.</div>

or

<div>Hover hear to make a tooltip appear beneath mouse</div>
<div class="hovertip">This is the HTML that will appear on mouseover.</div>

Thanks a lot!

#5

Xabi - January 19, 2007 - 00:06

Could this be done not based on video IDs, but un video URLs? Video IDs are a bad approach from the user side. It's better to paste the full URL into the bbcode and then transform it to a valid embed code.

#6

naudefj - January 19, 2007 - 20:15

To add a youtube tag, add this code to your bbcode-filter.inc file:

    '#\[youtube]([\w:;&,~%+!=@\/\.\-\#\?]+)\[/youtube(?::\w+)?\]#si'  =>
    '<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>',

The tooltip and clicktips would be more difficult to add as it required JavaScript coding as well.

#7

pnikosis - January 20, 2007 - 00:32

Great, thanks!
I'll use this as an example to add more tags if I need to :)

#8

naudefj - January 20, 2007 - 07:01
Status:active» fixed

Great - that is the spirit!

When done, please post your expressions here. Other people would also be able to benefit from them.

#9

Anonymous - February 3, 2007 - 07:16
Status:fixed» closed

#10

hanief84 - April 4, 2007 - 08:34

Cool! youTube filter there! Thumbs UP!

 
 

Drupal is a registered trademark of Dries Buytaert.