Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

video BBcode

Featured Replies

Hey sorry that i keep posting so many questions but i just have one more how would you create a BB code to like show a youtube video like this

[video]You tube video link[/video]

 

any help would be appriciated thanks in advance :)

Pretty simple function as long as you match the $find indices with the $replace it should work a treat. I'll look implementing a caching feature in the future.

 

http://www.kieranallen.com/2010/05/simple-bbcode/

 

<?php
function textToBB($string)
{
// Warning: YOU MUST htmlspecialchar this raw user input.
$string    =    htmlspecialchars($string,ENT_QUOTES,'utf-8');

// Format nicely
$string    =    nl2br($string);

// Patterns
$find    =    array(
	'/\[video\](.*?)\[\/video\]/is',
	'/:\)/'
);

// Replace with
$replace    =    array(
	'<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/$1&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/$1&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>',
	'<img src="images/happy.gif" alt="happy" />'
);

// Join them up
$string    =    preg_replace($find, $replace, $string);  

// return parsed code
return $string;
}


$string    =    'lots of text, etc etc look at my Youtube video: 

[video]BIduOvEoVeQ[/video]';

echo textToBB($string);

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.