Dragonfly CMS v9 ⇒ Modules & Blocks ⇒ [Tutorial] BBCode mod for YouTube ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum IndexModules & Blocks

[Tutorial] BBCode mod for YouTube Reply to topic


No, it does not work for those sites. But it does work on the regular Forums as well.

EHP Webmaster
www.ehpdesigns.com

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux OS / Apache 1.3.34 / MySQL 4.1.22 / PHP 4.4.7/ DF 9.1.2.1


MikieMouse,

Any chance it could be made to take in the entire URL's for videos rather than just the code? As you can imagine, many members don't understand how to extract the codes from the URL. They'd find it easier to just paste in the URL.

Cheers,

Ronin
Ronin Technologies
Dragonfly Google Maps Module

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Ubuntu 14.04 / 2.4.7 / 5.5.37 / 5.5.9 / 9.4.0.0


Ronin wrote
MikieMouse,

Any chance it could be made to take in the entire URL's for videos rather than just the code? As you can imagine, many members don't understand how to extract the codes from the URL. They'd find it easier to just paste in the URL.


I can show you what to change the code to so your user's input the video URL versus the video id (but I won't change the content of the code for future releases, it will still use the video id).

Open nbbocde.php from the includes directory.

Locate the line beginning:
// [youtube]

Replace this section with the following:
// [youtube]youtube_url_here[/youtube] code.. $patterns[] = "#\[youtube\]([\w]+(://|\.|/)[^ ("\n\r\t<]*?)\[/youtube\]#si"; $replacements[] = '<object width="425" height="350"><param name="movie" value="\\1"></param><embed src="\\1" type="application/x-shockwave-flash" width="425" height="350"></embed></object>';

You may also want to change the YouTube listing in includes/javascript in the bbcode.js file. Locate the YouTube helpline and change the following:
youtube_help="Insert video from YouTube: [youtube]YouTube Video ID[/youtube]";

To this:
youtube_help="Insert video from YouTube: [youtube]YouTube Video URL[/youtube]";

EHP Webmaster
www.ehpdesigns.com

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux OS / Apache 1.3.34 / MySQL 4.1.22 / PHP 4.4.7/ DF 9.1.2.1


**nevermind.. got my answer :)**

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
they\'re good.


$patterns[] = "#\[youtube\]([\w]+(://|\.|/)[^ (\"\n\r\t<]*?)\[/youtube\]#si";

but this code will allow to isnert any URL and parse it as a youtube URL.

Im using this, maybe is better, not sure:

$patterns[] = "#\[youtube\]http://(?:www\.)?youtube.com/watch\?v=([0-9A-Za-z-_]{11})[^[]*\[/youtube\]#is";

www.greenday2k.net

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


The new versions of both the DF Multimedia and the NBBCode Mod will allow people to choose to use either the full URL or just the code (or maybe I'll go to just the full URL...haven't decided yet).

EHP Webmaster
www.ehpdesigns.com

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux OS / Apache 1.3.34 / MySQL 4.1.22 / PHP 4.4.7/ DF 9.1.2.1


Why dont you use the INSERT FLASH button
and just use the actual FLASH file location from the YouTube server?

For example, say the youtube URL is
www.youtube.com/watch?v=f5Fg6KFcOsU

simple, just change it to the swf link

the above code would become
www.youtube.com/watch/v/f5Fg6KFcOsU.swf

check the "?" to a "/"
change the "=" to a "/"
and tack a ".swf" to the end of the url

This applies ot all Youtube direct URLS

Please enter your server specs in your user profile! 😢


Doing the same for Youtube and Google Video, and with subdomians of youtube: es.youtube.com, fr.youtube.com, etc.

Changes in BBcode for installing two buttons forYoutube and Gvideo videos.

For Dragonflycms 9.X

Files:

“includes/nbbcode.php”
“includes/javascript/bbcode.js”
“languages/spanish/bbcode.php”
“languages/english/bbcode.php”
“images/video”
(directory for images of video buttons)


Searching for languages files and in the array common (arround 98 line) insert:
Spanish (“languages/spanish/bbcode.php”):

'youtube' => array('Insertar archivo de video Youtube:','[youtube]Archivo URL[/youtube]'),
'gvideo' => array('Insertar archivo de video gVideo:','[gvideo]Archivo URL[/gvideo]'),


English (“languages/english/bbcode.php”):

'youtube' => array('Insert video file Youtube:','[youtube]file URL[/youtube]'),
'gvideo' => array('Insert video file gVideo:','[gvideo]file URL[/gvideo]'),


I upload to icons for youtube and Gvideo in the directory “images/video”: and

Modify “includes/javascript/bbcode.js”:


function BBCwmi(form, field, type) {
if (type == 'img') { var URL = prompt("Please enter image URL","http://"); }
else {
if (type == 'youtube') { var URL = prompt("Please enter Youtube Video URL","http://");
} else {
if (type == 'gvideo') { var URL = prompt("Please enter gVideo URL","http://");
} else {
var URL = prompt("Enter the Email Address",""); }}}
if (URL == null) { return; }
if (!URL) { return alert("Error : You didn't write the Address"); }
BBCwrite(form, field, '', "["+type+"]"+URL+"[/"+type+"]", true);
}


Go to "includes/nbbcode.php" and insert:

Line 185:
video_help="'. $bbcode_common['video'][0].' '.$bbcode_common['video'][1].'";
youtube_help="'. $bbcode_common['youtube'][0].' '.$bbcode_common['youtube'][1].'";
gvideo_help="'. $bbcode_common['gvideo'][0].' '.$bbcode_common['gvideo'][1].'";


With this I have the help text when I my mouse is over the Video buttons

If my version is 9.2, in line 190

var youtube_help="'. $bbcode_common['youtube'][0].' '.$bbcode_common['youtube'][1].'"
var gvideo_help="'. $bbcode_common['gvideo'][0].' '.$bbcode_common['gvideo'][1].'"
var video_help="'. $bbcode_common['video'][0].' '.$bbcode_common['video'][1].'"


Arroun 236 line insert the buttons tha will be appears que in the bbdode forms “reply” o “new topic”, but also in news.

<img alt="'.$bbcode_common['flash'][0].'" class="bbcbutton" onmouseover="helpline(\''.$form.'\',\''.$field.'\',\'flash\')" onclick="BBCmm(\''.$form.'\',\''.$field.'\',\'flash\')" name="flash" src="'.$bbbttns_path.'flash.gif" border="0" />
<img alt="'.$bbcode_common['youtube'][0].'" class="bbcbutton" onmouseover="helpline(\''.$form.'\',\''.$field.'\',\'youtube\')" onclick="BBCwmi(\''.$form.'\',\''.$field.'\',\'youtube\')" name="youtube" src="images/video/youtube.gif" border="0" />
<img alt="'.$bbcode_common['gvideo'][0].'" class="bbcbutton" onmouseover="helpline(\''.$form.'\',\''.$field.'\',\'gvideo\')" onclick="BBCwmi(\''.$form.'\',\''.$field.'\',\'gvideo\')" name="gvideo" src="images/video/gvideo.gif" border="0" />
<img alt="'.$bbcode_common['video'][0].'" class="bbcbutton" onmouseover="helpline(\''.$form.'\',\''.$field.'\',\'video\')" onclick="BBCmm(\''.$form.'\',\''.$field.'\',\'video\')" name="video" src="'.$bbbttns_path.'video.gif" border="0" />



In 9.2 version, you must insert in 242 line

Line 515 ( 9.2 version in 525 line) Here you ad patterns for videos (it acepts videos with domains es.youtube.com, fr.youtube.com, etc ...)

# [youtube] and [/youtube] code..

$patterns[] = "#\[youtube\]http://(?:[A-Za-z]{2,3}\.)?youtube.com/watch\?v=([0-9A-Za-z-_]{11})[^[]*\[/youtube]#is";
$replacements[] = '
<!-- BEGIN youtube -->
<object width="425" height="350">
<param name="movie" value="http://www.youtube.com/v/http://www.youtube.com/v/\\1.swf"></param>
<embed src="http://www.youtube.com/v/http://www.youtube.com/v/\\1.swf" type="application/x-shockwave-flash" width="425" height="350"></embed>
</object><br />
<!-- END youtube -->
';

# [gvideo] and [/gvideo] code..

$patterns[] = "#\[gvideo\]http://(?:www\.)?video\.google\.([A-Za-z]*)/videoplay\?docid=([0-9\-]*.\&*)[^[]*\[/gvideo]#is";
$replacements[] = '
<!-- BEGIN gVideo -->
<embed id="VideoPlayback" src="http://video.google.com/googleplayer.swf?docid=\\2" style="width:425px;height:350px" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash"> </embed>
<!-- END gVideo -->
';

# [video width= height= loop= ] and [/video] code..
$patterns[] = "#\[video width=([0-6]?[0-9]?[0-9]) height=([0-4]?[0-9]?[0-9])\]([\w]+?://[^ \?&="\n\r\t<]*?(\.(avi|mpg|mpeg|wmv)))\[/video]#si";
$replacements[] = '<embed src="\\3" width=\\1 height=\\2></embed>';


And finish...

Note: refresh your navigator because javascript in bbcode can be in your PC cache.

Aforo - Google Earth - WebNaranja - DFcms.es

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Centos 5/Apache 2.2.3/MySQL:5.0.45/PHP:5.2.10 /9.2


Thanks Aforo! Still valid for latest CVS (9.2.3.1).

Cheers,

Ronin
Ronin Technologies
Dragonfly Google Maps Module

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Ubuntu 14.04 / 2.4.7 / 5.5.37 / 5.5.9 / 9.4.0.0


Where are we at on the way to display url entry and the code entry v=(XXXXXXXXXX) methods?

dfaddons.com

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
OS/Apache/Mysql/php/9.2.X/


<!-- BEGIN youtube -->
<object width="425" height="350">
<param name="movie" value="http://www.youtube.com/v/http://www.youtube.com/v/\\1.swf"></param>
<embed src="http://www.youtube.com/v/http://www.youtube.com/v/\\1.swf" type="application/x-shockwave-flash" width="425" height="350"></embed>
</object><br />
<!-- END youtube -->


Full Screen mode
<!-- BEGIN youtube --> <object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/http://www.youtube.com/v/\\1.swf?fs=1&hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param> <embed src="http://www.youtube.com/v/http://www.youtube.com/v/\\1.swf?fs=1&hl=en_US" type="application/x-shockwave-flash" width="425" height="350" allowscriptaccess="always" allowfullscreen="true"></embed></object><br /> <!-- END youtube -->

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
9.2.1


No longer works in 9.3.x with upgraded phpbb.

CENTOS 5.9 i686 virtuozzo Kernel 2.6.32-042stab076.8 / Apache 2.2.24 / My SQL 5.1.70-cll/ PHP 5.3.25/ CMS 9.3.3.1

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
CENTOS 5.9 i686 virtuozzo Kernel 2.6.32-042stab076.8 / Apache 2.2.24 / My SQL 5.1.70-cll/ PHP 5.3.25/ CMS 9.3.3.1


Which bit?, we have working youtube for the latest forums if you need some help with it.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0


So using the mod at the beginning of this post, it changes the image location. From what I can make out the link to the images for the buttons is in themes using latest DF, where as the mod provided changes the location of all the images(buttons) to images/bbcode not themes/images/bbcode.

Looking at manual instructions ... the new nbbcode file is very different ... so can't even follow the manual instructions. If someone has the modified nbbcode file dated 2012/01/21 which has the youtube code in it (working) ... that would help. But the zip file in this string is the 2006 version of nbbcode.

Thanks for any help

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
CENTOS 5.9 i686 virtuozzo Kernel 2.6.32-042stab076.8 / Apache 2.2.24 / My SQL 5.1.70-cll/ PHP 5.3.25/ CMS 9.3.3.1


I tried to get this code to work outside of the forums and could not get it to work. This does not play well with 9.3X.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
linux,apache,5.0.11.,5.6.30,9.3.4.1

All times are UTC


Jump to: