Important Notice:
Two sections of this forum are available only to registered customers. In order to receive access to the Customer Forums and ResellerCentral Forums, you must first register on these forums or login to your existing forum account. If you are an existing HostNine customer, be sure to register using the email address on file for your billing profile.
|
|||||||
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Ok i have built a custom news script for my site that uses BBcode. I would like to be able to embed youtube videos using the following
"[youtube]Youtube link here[/youtube]" but for some reason i can't get it to work. Here is an example of how i am doing my BBcode so if any one can edit this to work as a youtube BBcode that would be great! $data = str_replace("[big]", "<h1>", $data); $data = str_replace("[/big]", "</h1>", $data); |
|
#2
|
|||
|
|||
|
You could just str_replace with arrays to make the conversions much easier --
$toReplace = array("<h1>", "</h1>"); $toBeReplaced = array('[youtube]', '[/youtube]'); //Note the double-slash $newphrase = str_replace($toReplace, $toBeReplaced, $data); Your example should work perfectly, but what's provided above will allow you to use a single call with an array to function rather than nesting potentially hundreds of calls to str_replace. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|




Linear Mode
