MyBB Community Forums

Full Version: Custom php page.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, i want to create a empty page where put youtube embed, the page will be black with only the youtube frame.

like this: http://localhost/showthread.php?tid=12
this link lets me see the thread number 12

i want to make a page like this http://localhost/video.php?v=KMU0tzLwhbE

where v=KMU0tzLwhbE is the youtube video id
http://www.youtube.com/watch?v=KMU0tzLwhbE

how to? please help
I use this idea for custom pages: https://community.mybb.com/thread-116225.html
I mean this is an extremely simple PHP page. Literally just very basic CSS to make the whole page black and then YouTube provides their embed code which you can just copy paste and grab the video ID from the URL. If you're having to ask how to do this then likely you just need to learn some basic PHP because this is essentially a result you could get easily from any of the thousands of introductory PHP tutorials out there.

If you're still having trouble I'd suggest posting in the Plugin Development section because you'll get better coding help in that forum. Though again, at least Google creating a simple PHP page before you post in there, this is very simple stuff you're requesting.
Here

1. Make a new file called video.php with this content:
<?php

define( 'IN_MYBB', 1 );
require_once './global.php';

if( empty( $mybb->input['v'] ) )
{
error( 'Specify a video id.' );
}
else
{
$v = $mybb->input['v'];
eval( '$page = "' . $templates->get( 'video' ) . '";' );
output_page( $page );
}

2. Make a new template called video with this content
<style>
 body {
background: #000
}

.container {
position: relative;
width: 100%;
height: 0;
padding-bottom: 56.25%;
}

.video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>

<div class="container">
<iframe src="//www.youtube.com/embed/{$v}?autoplay=1" frameborder="0" allowfullscreen class="video"></iframe>
</div>

Result: https://a.pomf.cat/pudqeb.mp4
(2017-08-17, 03:49 AM)Sazze Wrote: [ -> ]Here

1. Make a new file called video.php with this content:
<?php

define( 'IN_MYBB', 1 );
require_once './global.php';

if( empty( $mybb->input['v'] ) )
{
error( 'Specify a video id.' );
}
else
{
$v = $mybb->input['v'];
eval( '$page = "' . $templates->get( 'video' ) . '";' );
output_page( $page );
}

2. Make a new template called video with this content
<style>
 body {
background: #000
}

.container {
position: relative;
width: 100%;
height: 0;
padding-bottom: 56.25%;
}

.video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>

<div class="container">
<iframe src="//www.youtube.com/embed/{$v}?autoplay=1" frameborder="0" allowfullscreen class="video"></iframe>
</div>

Result: https://a.pomf.cat/pudqeb.mp4
Thank You So much!