Previous Thread
Next Thread
Print Thread
Rate Thread
YouTube Video - Custom Tag #321200
09/21/2015 10:02 PM
09/21/2015 10:02 PM
Joined: Jan 2000
Posts: 5,947
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord

Joined: Jan 2000
Posts: 5,947
Portland, OR, USA
About
This Custom Tag will allow you to syndicate YouTube Videos. Users will need to copy the "Video URL" (or Video ID) into the video tags (or the editor if enabled).

Tags
Code
[video:youtube][/video]


Example
An example of the embedded video can be found on the VNC Web Services Demo Forums.

Note
The code supplied below must be imported to the Custom Tags feature of your UBB.threads install; the coding escapes any slashes, so just copy and pasting to your existing install just plain will not work, please use the import function.

Install
Save "CustomTag.txt" (with the code provided) and import into the "Custom Tags" feature of the control panel:
Control Panel -> Tools & Info -> Content Rebuilder -> Custom Tags -> Import new tags (bottom tab)

UBBT7.6.0-CustomTag.txt
PHP Code

<?php
$export_tags = array (
  0 => 
  array (
	'tag' => 'video:youtube',
	'descrip' => 'YouTube Video',
	'prompt' => 'YouTube URL or ID; eg: http://www.youtube.com/watch?v=xxxxxxxxxx',
	'regex' => '(|.*youtu\\.be/|.*v=)([a-zA-Z0-9_-]{8,12})(|&.*)',
	'markup' => '<div class="video-container"><iframe frameborder="0" width="640" height="360" src="https://www.youtube.com/embed/\\\\2" allowfullscreen></iframe></div>',
  ),
);
?>



UBBT7.5.x-CustomTag.txt
PHP Code

<?php
$export_tags = array (
  0 => 
  array (
	'tag' => 'video:youtube',
	'descrip' => 'YouTube Video',
	'prompt' => 'YouTube URL or ID; eg: http://www.youtube.com/watch?v=xxxxxxxxxx',
	'regex' => '(|.*youtu\\.be/|.*v=)([a-zA-Z0-9_-]{8,12})(|&.*)',
	'markup' => '<iframe frameborder="0" width="400" height="255" src="https://www.youtube.com/embed/\\\\2" allowfullscreen></iframe>',
  ),
);
?>



Compatibility
The v7.6.0 works with the updated common.css file entries in v7.6.0 to responsively display your videos depending on the size of your browser window (to a maximum of 640x360). As these classes do not exist in previous builds an additional set of code is provided for 7.5.x which displays videos in a 16:9 resolution of 400x255.

Attached Files

UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.SitemapsJames Corthell
Sponsored Links
Re: YouTube Video - Custom Tag [Re: Gizmo] #321204
09/21/2015 11:38 PM
09/21/2015 11:38 PM
Joined: Jan 2000
Posts: 5,947
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord

Joined: Jan 2000
Posts: 5,947
Portland, OR, USA


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.SitemapsJames Corthell
Re: YouTube Video - Custom Tag [Re: Gizmo] #321205
09/21/2015 11:39 PM
09/21/2015 11:39 PM
Joined: Jul 2001
Posts: 1,208
California
isaac Offline
$coffee=code(true);
isaac  Offline
$coffee=code(true);

Joined: Jul 2001
Posts: 1,208
California
https://www.youtube.com/watch?v=mVmBL8B-In0

[video:youtube]mVmBL8B-In0[/video]


isaac @ id242.com // my forum @ CelicaHobby.com
a current developer of UBB.threads php forum software // 7.6.x Progress Reports
Re: YouTube Video - Custom Tag [Re: Gizmo] #321206
09/22/2015 12:53 AM
09/22/2015 12:53 AM
Joined: Nov 2003
Posts: 331
UK
M
Mark_S Offline

Beta Tester
Mark_S  Offline

Beta Tester
M

Joined: Nov 2003
Posts: 331
UK
Which versions can this be used on ? smile


BOOM 7.6.+ rocks....
Re: YouTube Video - Custom Tag [Re: Gizmo] #321208
09/22/2015 6:30 AM
09/22/2015 6:30 AM
Joined: Jan 2000
Posts: 5,947
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord

Joined: Jan 2000
Posts: 5,947
Portland, OR, USA
I've updated the post, there is code listed for the v7.5.x series and the upcoming 7.6.0 release which has the variable width bits in.


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.SitemapsJames Corthell
Sponsored Links
Re: YouTube Video - Custom Tag [Re: Gizmo] #321935
08/13/2016 2:16 AM
08/13/2016 2:16 AM
Joined: Nov 2003
Posts: 331
UK
M
Mark_S Offline

Beta Tester
Mark_S  Offline

Beta Tester
M

Joined: Nov 2003
Posts: 331
UK
Hi Guys,
My youtube embedded videos have failed over the last few days.
I'm hoping this is the page with the latest update...

I'm running 7.5.9x
I have tried to import both codes from the first post with out success. I get a white screen, and all permissions are green with the permissions check.

See below for what happened and the code i have running now that is giving me that problem.

I'm assuming this is the page with the latest updates for custom tags.

Thanks in advance.

Attached Files
video-tags.JPG (77 downloads)
Forum image
video-tags2.JPG (77 downloads)
Tag code causing the problem

BOOM 7.6.+ rocks....
Re: YouTube Video - Custom Tag [Re: Gizmo] #321936
08/13/2016 2:58 AM
08/13/2016 2:58 AM
Joined: Nov 2003
Posts: 331
UK
M
Mark_S Offline

Beta Tester
Mark_S  Offline

Beta Tester
M

Joined: Nov 2003
Posts: 331
UK
I have now manually updated the tag code from Pre-v7.6.0 CustomTag.txt above and there is no change.

I was going to post this in the bugs section on ubb but as I pressed the preview its working fine over there ?
Ive not done any updates, and its the members that have come to me with this strange change.

See attached image for the manual entered code.

Attached Files
video-tags3.JPG (75 downloads)

BOOM 7.6.+ rocks....
Re: YouTube Video - Custom Tag [Re: Gizmo] #321937
08/13/2016 3:16 AM
08/13/2016 3:16 AM
Joined: Nov 2003
Posts: 331
UK
M
Mark_S Offline

Beta Tester
Mark_S  Offline

Beta Tester
M

Joined: Nov 2003
Posts: 331
UK
I get the box size with the latest code above but an error on play.

Same youtube link HeplUHZsHfo entered on this forum.

[video:youtube]HeplUHZsHfo[/video]

OMG i didn't realise its Barry lol

Attached Files
video-tags4.JPG (73 downloads)
Error on play
Last edited by Mark_S; 08/13/2016 3:18 AM.

BOOM 7.6.+ rocks....
Re: YouTube Video - Custom Tag [Re: Gizmo] #321938
08/13/2016 3:26 AM
08/13/2016 3:26 AM
Joined: Jul 2001
Posts: 1,208
California
isaac Offline
$coffee=code(true);
isaac  Offline
$coffee=code(true);

Joined: Jul 2001
Posts: 1,208
California
Hey Mark, Im not sure if this will help you out or not, but this is a screen cap from UBBDev's current YouTube Custom Tag for UBB.threads 7.6.0 (Snapshot 20160813)

There is also a "common.css" file which is unique to UBBT v7.6.x series.

You can paste the following code in to your style sheet's EXTRAS section, if you are not currently on a 7.6.x series install. You'll need to do it to each of your styles. And then when you move to 7.6.x, you'll probably need to remove it at that time, since it will duplicate functionality.

Code
/* video embeds */
.video-container {height:0;overflow:hidden;position:relative;padding-bottom:56.25%;padding-top:30px;}
.video-container iframe,.video-container object,.video-container embed {height:100%;left:0;position:absolute;top:0;width:100%;}

Attached Files
20160813_04-24-23.PNG (73 downloads)
Last edited by id242; 08/13/2016 3:31 AM. Reason: added some css

isaac @ id242.com // my forum @ CelicaHobby.com
a current developer of UBB.threads php forum software // 7.6.x Progress Reports
Re: YouTube Video - Custom Tag [Re: Gizmo] #321939
08/13/2016 4:01 AM
08/13/2016 4:01 AM
Joined: Nov 2003
Posts: 331
UK
M
Mark_S Offline

Beta Tester
Mark_S  Offline

Beta Tester
M

Joined: Nov 2003
Posts: 331
UK
Hey thanks ID but it did not work.
I got the nice big screen size smile

However an error on play back.

See attached

I have tried this in EDGE and the same issue.
Ive done a google and no one else is moaning yet. . . .

Attached Files
video-tags5.JPG (65 downloads)
Tag Details
video-tags6.JPG (61 downloads)
Displays as expected
video-tags7.JPG (61 downloads)
Pressing play gives the following error.

BOOM 7.6.+ rocks....
Sponsored Links
Re: YouTube Video - Custom Tag [Re: Gizmo] #321940
08/13/2016 4:07 AM
08/13/2016 4:07 AM
Joined: Jul 2001
Posts: 1,208
California
isaac Offline
$coffee=code(true);
isaac  Offline
$coffee=code(true);

Joined: Jul 2001
Posts: 1,208
California
You have too many slashes near your "/embed/\\2" code.

You should not copy/paste the items in to the boxes from the above code. Instead, copy the whole code in to a txt file, and then import that text file to the Tag Editor.


isaac @ id242.com // my forum @ CelicaHobby.com
a current developer of UBB.threads php forum software // 7.6.x Progress Reports
Re: YouTube Video - Custom Tag [Re: Gizmo] #321941
08/13/2016 4:23 AM
08/13/2016 4:23 AM
Joined: Nov 2003
Posts: 331
UK
M
Mark_S Offline

Beta Tester
Mark_S  Offline

Beta Tester
M

Joined: Nov 2003
Posts: 331
UK
It does not work the importer - white screen as posted above.
i will go with "/embed/\\2"

Yes that worked on the new code smile smile

Adding the following code to the media prompt 9my you tube button)

working with
J1v9IqL8Z1g

But not
https://youtu.be/J1v9IqL8Z1g

See attached.

But my old videos are still only showing as previous a tall back box ??
I still have the style sheet extras.

Need to play for a bit and see what is going on. . . .

Attached Files
video-tags8.JPG (52 downloads)
Last edited by Mark_S; 08/13/2016 4:23 AM.

BOOM 7.6.+ rocks....
Re: YouTube Video - Custom Tag [Re: Mark_S] #321943
08/13/2016 4:42 AM
08/13/2016 4:42 AM
Joined: Jul 2001
Posts: 1,208
California
isaac Offline
$coffee=code(true);
isaac  Offline
$coffee=code(true);

Joined: Jul 2001
Posts: 1,208
California
Originally Posted by Mark_S
But my old videos are still only showing as previous a tall back box ??
I still have the style sheet extras.


Since you basically "added a new UBBCode" (or updated your current code), you need to run the content rebuilder.

Control Panel ยป Content Rebuilder > Rebuild Posts

Quote
Rebuild Posts
Select this action if you've added a new UBBCode or if you've edited the list of censored words.


hint: If you enter the post editor on one of your old youtube posts and click the "Preview Post" button, you will get an idea of what the rest of your posts will look like before running the rebuilder on your whole forums.


isaac @ id242.com // my forum @ CelicaHobby.com
a current developer of UBB.threads php forum software // 7.6.x Progress Reports
Re: YouTube Video - Custom Tag [Re: Gizmo] #321944
08/13/2016 5:01 AM
08/13/2016 5:01 AM
Joined: Nov 2003
Posts: 331
UK
M
Mark_S Offline

Beta Tester
Mark_S  Offline

Beta Tester
M

Joined: Nov 2003
Posts: 331
UK
Thanks ID242,
I have the https working now.

The devil is in the detail and your snapshots helped. The code in the first post needs some attention as it has the extra slashes in it and also the regex.

That's a great little trick the preview post...

I'm at a loss what has caused this to randomly fail ??


BOOM 7.6.+ rocks....
Re: YouTube Video - Custom Tag [Re: Mark_S] #321945
08/13/2016 5:10 AM
08/13/2016 5:10 AM
Joined: Jul 2001
Posts: 1,208
California
isaac Offline
$coffee=code(true);
isaac  Offline
$coffee=code(true);

Joined: Jul 2001
Posts: 1,208
California
Originally Posted by Mark_S
The devil is in the detail and your snapshots helped. The code in the first post needs some attention as it has the extra slashes in it and also the regex.


The code in the first posts works if you dump it in to a text file and then import that text to your Custom Tag editer, by way of the "Import New Tags" button at the bottom. The newly imported tags will be prefixed with "new", so as to not be confused with your current tags.

The additional backslashes ( \\\\ ) in the OP's code, are intentional. They escape the following backslash.
You can read more on that at http://php.net/manual/en/regexp.reference.escape.php

I'm happy to hear that you finally got it all worked out
cheers!


isaac @ id242.com // my forum @ CelicaHobby.com
a current developer of UBB.threads php forum software // 7.6.x Progress Reports
Re: YouTube Video - Custom Tag [Re: Gizmo] #321947
08/13/2016 11:22 AM
08/13/2016 11:22 AM
Joined: Jan 2000
Posts: 5,947
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord

Joined: Jan 2000
Posts: 5,947
Portland, OR, USA
Yeah, as Isaac stated, these are to be imported (hence "CustomTags.txt") and not just copied over; I'll update the OP with more clarity


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.SitemapsJames Corthell
Re: YouTube Video - Custom Tag [Re: Gizmo] #321950
08/14/2016 5:15 AM
08/14/2016 5:15 AM
Joined: Nov 2003
Posts: 331
UK
M
Mark_S Offline

Beta Tester
Mark_S  Offline

Beta Tester
M

Joined: Nov 2003
Posts: 331
UK
Thanks for the help, appreciated.
However my importer is not working (White Screen upon submitting the file).

It's unlikely i will have to use it again, before version 6 so not worth going in to it.

I will be going clean install when 6 arrives smile



BOOM 7.6.+ rocks....
Re: YouTube Video - Custom Tag [Re: Gizmo] #321951
08/14/2016 12:21 PM
08/14/2016 12:21 PM
Joined: Jan 2000
Posts: 5,947
Portland, OR, USA
Gizmo Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline OP

UBB.Dev / UBB.Wiki Owner
Time Lord

Joined: Jan 2000
Posts: 5,947
Portland, OR, USA
Clean install? on your main site? why start from scratch?!?

Does your error log have any entries after you get a white screen trying to import?


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, UBB.SitemapsJames Corthell

Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with, and recommend, the following Web Hosts:
· Stable Host
· Blue Host
· Interserver.net
Visit us on Facebook
Member Spotlight
Bill B
Bill B
Issaquah, WA
Posts: 84
Joined: December 2001
Show All Member Profiles 
Forum Statistics
Forums64
Topics37,466
Posts293,522
Members13,801
Most Online1,498
Mar 17th, 2017
Top Posters(All Time)
AllenAyres 25,587
JoshPet 11,330
Rick 8,373
LK 7,396
Lord Dexter 6,503
Gizmo 5,947
Greg Hard 5,533
Top Posters(30 Days)
isaac 1
Today's Statistics
Currently Online 811
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 10
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2018 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 7.7.0
(Snapshot build 20181115.dev)
PHP: 5.4.45 Page Time: 0.051s Queries: 22 (0.013s) Memory: 3.3176 MB (Peak: 3.5810 MB) Data Comp: Zlib Server Time: 2018-12-11 05:18:54 UTC