|
|
| |
Forums ⇒ DragonflyCMS ⇒ Add-Ons & Blocks ⇒ [Tutorial] BBCode mod for YouTube
[Tutorial] BBCode mod for YouTubeNeed help creating a block or add-on, or you have created or modified a block/add-on that works in Dragonfly CMS and it meets the CPG Security Requirements? Do you have feedback about a specific add-on? Here is the place to post. Read the announcements here first!.
Go to page Previous 1, 2
|
View previous topic :: View next topic |
| Author |
Message |
MikieMouse 500+ Posts Club


Offline Joined: Jun 27, 2004 Posts: 500 Location: South Dakota
|
Posted: Wed Jan 24, 2007 1:33 pm Post subject: Re: [Tutorial] BBCode mod for YouTube |
|
No, it does not work for those sites. But it does work on the regular Forums as well.
_________________ EHP Webmaster
www.ehpdesigns.com
MikieMouse's 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
|
|
| Back to top |
|
 |
Ronin Dragonfly addicted


Offline Joined: Jun 07, 2004 Posts: 475 Location: Calgary, AB
|
Posted: Thu Feb 08, 2007 6:01 pm Post subject: Re: [Tutorial] BBCode mod for YouTube |
|
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
Ronin's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Lunarpages Linux / 1.3.37 / 4.1.22-standard-log / 4.4.4 / 9.1.2.5
|
|
| Back to top |
|
 |
MikieMouse 500+ Posts Club


Offline Joined: Jun 27, 2004 Posts: 500 Location: South Dakota
|
Posted: Thu Feb 08, 2007 6:28 pm Post subject: Re: [Tutorial] BBCode mod for YouTube |
|
| 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:
Replace this section with the following:
| PHP: |
// [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:
| PHP: |
youtube_help="Insert video from YouTube: [youtube]YouTube Video ID[/youtube]";
|
To this:
| PHP: |
youtube_help="Insert video from YouTube: [youtube]YouTube Video URL[/youtube]";
|
_________________ EHP Webmaster
www.ehpdesigns.com
MikieMouse's 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
|
|
| Back to top |
|
 |
blane Newbie


Offline Joined: Aug 14, 2008 Posts: 1
|
Posted: Thu Aug 14, 2008 10:32 pm Post subject: Re: [Tutorial] BBCode mod for YouTube |
|
**nevermind.. got my answer :)**
blane's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) they\'re good.
|
|
| Back to top |
|
 |
greenday2k Forum Admin


Offline Joined: Aug 11, 2005 Posts: 489 Location: CO
|
Posted: Fri Aug 15, 2008 3:03 am Post subject: Re: [Tutorial] BBCode mod for YouTube |
|
| Code:: |
$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:
| Code:: |
$patterns[] = "#\[youtube\]http://(?:www\.)?youtube.com/watch\?v=([0-9A-Za-z-_]{11})[^[]*\[/youtube\]#is"; |
_________________ www.greenday2k.net

greenday2k's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
|
|
| Back to top |
|
 |
MikieMouse 500+ Posts Club


Offline Joined: Jun 27, 2004 Posts: 500 Location: South Dakota
|
Posted: Fri Aug 15, 2008 3:15 am Post subject: Re: [Tutorial] BBCode mod for YouTube |
|
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
MikieMouse's 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
|
|
| Back to top |
|
 |
deleted_8582 Nice poster


Offline Joined: Jun 09, 2007 Posts: 145
|
Posted: Fri Nov 07, 2008 4:08 am Post subject: Re: [Tutorial] BBCode mod for YouTube |
|
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
| Code:: |
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
deleted_8582 please enter your server specs in your user profile!
|
|
| Back to top |
|
 |
Aforo I18N / L10N Lead Dev


Offline Joined: Dec 27, 2007 Posts: 146
|
Posted: Mon Nov 10, 2008 10:30 am Post subject: Re: [Tutorial] BBCode mod for YouTube |
|
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 for Youtube 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”):
| Quote:: |
'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”):
| Quote:: |
'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”:
| Quote:: |
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:
| Quote:: |
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
| Quote:: |
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.
| Quote:: |
<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 ...)
| Quote:: |
# [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
Aforo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Centos 5/Apache 2.2.3/MySQL:5.0.45/PHP:5.2.10 /9.2
|
|
| Back to top |
|
 |
Ronin Dragonfly addicted


Offline Joined: Jun 07, 2004 Posts: 475 Location: Calgary, AB
|
Posted: Sat Jul 10, 2010 7:59 pm Post subject: Re: [Tutorial] BBCode mod for YouTube |
|
Thanks Aforo! Still valid for latest CVS (9.2.3.1).
_________________ Cheers,
Ronin
Ronin Technologies
Dragonfly Google Maps Module
Ronin's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Lunarpages Linux / 1.3.37 / 4.1.22-standard-log / 4.4.4 / 9.1.2.5
|
|
| Back to top |
|
 |
earth Heavy poster


Offline Joined: Mar 01, 2006 Posts: 268
|
Posted: Sun Jul 11, 2010 5:51 pm Post subject: Re: [Tutorial] BBCode mod for YouTube |
|
Where are we at on the way to display url entry and the code entry v=(XXXXXXXXXX) methods?
_________________ dfaddons.com
earth's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) OS/Apache/Mysql/php/9.2.X/
|
|
| Back to top |
|
 |
Zerogamer Newbie


Offline Joined: Apr 27, 2011 Posts: 5
|
Posted: Thu May 19, 2011 3:05 am Post subject: Re: [Tutorial] BBCode mod for YouTube |
|
| Quote:: |
<!-- 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
| Code:: |
<!-- 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 --> |
Zerogamer's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) 9.2.1
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
| |
 |
 Welcome Anonymous
|
|
|
|