Topic: [How To] Add BBCODES into pun_bbcode OFFICIAL Extension
Sorry, I speak english a little bit.
It's very easy add customs bbcodes to you PunBB forum througth "pun_bbcode" official extension
You must edit only 2 files.
- /extensions/pun_bbcode/bar.php
- /includes/parser.php
In first file you must put the "name" of the bbcode you are including. For example, i'm going to put bbcode for YOUTUBE, GOOGLE VIDEO, and VIMEO.
// List of tags, which may have attribute
$tags_without_attr = array('b', 'i', 'u', 'url', 'email', 'img', 'list', 'youtube','google','vimeo', 'li' => '*', 'quote', 'code');
Ok ?? Now we want transform bbcode_tags to html. We need write the pattern and the replace lines into parser.php
//
// Convert BBCodes to their HTML equivalent
//
$replace[] = '<span style="color: $1">$2</span>';
$replace[] = '</p><h5>$1</h5><p>';
//INSERT HERE YOUR BBCODES TAGS
//YOUTUBE
$pattern[] = '#\[youtube\](.*?)\[/youtube\]#s';
$replace[] = '<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>';
//GOOGLE VIDEO
$pattern[] = '#\[google\](.*?)\[/google\]#s';
$replace[] = '<object width="425" height="364"><param name="movie" value="http://video.google.com/googleplayer.swf?docId=$1"></param><embed src="http://video.google.com/googleplayer.swf?docId=$1" type="application/x-shockwave-flash" width="425" height="364"></embed></object>';
//VIMEO PATTERN
$pattern[] = '#\[vimeo\](.*?)\[/vimeo\]#s';
$replace[] = '<object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=$1&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=$1&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object><br /><a href="http://vimeo.com/$1" target="_blank">http://vimeo.com/$1</a> on <a href="http://vimeo.com" target="_blank">Vimeo</a>.';
USAGE:
You must put only the id-video bettween tags:
[youtube]Video-id[/youtube]
[video]Video-id[/video]
[google]Video-id[/google]
IMAGES:
You need put the images for bbcodes into /extensions/pun_bbcode/buttons/[template]/ and must be named as:
google.png, youtube.png, vimeo.png ........
IT's SO EASY !!!!!!!
Here a screenshot: