1 flybank Mar 31, 2007 16:47
3 samredman Apr 01, 2007 01:41
There is a youtube video which some people like which is located here:
http://plugins.b2evolution.net/index.php/2006/10/10/youtube_plugin
I personally did not like that... because it incorporates the youtube search as part of your post area and also I was somewhat wary of a plugin like that slowing things down. But, lots of people really like that plug in and it may be great for you.
Alternatively, you can make some hacks into your _formatting.php file and be able to just paste in your video html code straightaway. (Although you will have to also offset it by <div>video htmlcode here</div> tags).
Here is the step-by-step to hack your _formatting.php file:
A. First, any time you are going to make a change in any file, copy the original (the one that is working now) with a safety backup name. In this case, you are working with the _formatting.php file, so copy that as _formattingSAFE1.php, and keep a copy on your local machine. Anytime you "collapse" your b2evo, because of a change, you simply copy the safe version back onto your server as the original file name (overwriting the messed up one) and you will be back running again as good as new.
B. Here are the changes you need to make in your _formatting.php file:
1. Find this code:
$allowed_tags = array
(
'body' => E_Flow, // Remember this is not a true body, just a post body
'div' => E_Flow,
'p' => E_Iinline,
2. Change it to this code:
$allowed_tags = array
(
'body' => E_Flow, // Remember this is not a true body, just a post body
'div' => E_Flow.'iframe object param embed ',
'p' => E_Iinline.'iframe object param embed ',
Note: that is a period, not a comma after the E_flow and the E_Iinline, for your new 'div' and 'p' parameters.
3. Next, scroll down to the bottom of that same grouping to find this:
'ol' => 'li',
);
4. Add the last two lines of code shown following, so it now looks like this:
'ol' => 'li',
'object' => E_Flow.' param embed',
'param' => E_Flow.' embed',
);
5. Next find this code:
$allowed_tags += array
(
'img' => '',
6. At the bottom of that listing of tags will be this:
'td' => E_Flow,
);
7. Add the lines shown so that it now looks like this:
'td' => E_Flow,
'embed' => E_Iinline, E_Flow,
'object' => E_Iinline, E_Flow,
'param' => E_Iinline, E_Flow,
);
8. Next find this code:
// Array showing allowed attributes for tags
if( $use_strict )
{
$allowed_attributes = array
(
'div' => A_attrs,
9. At the end of that listing of attributes you will see this:
'td' => A_attrs.' abbr axis headers scope rowspan colspan'.A_cellhalign.' '.A_cellvalign, // Strict
);
10. Add these lines of attributes underneath that line above, like this:
'embed' => A_attrs.' src width height autostart type wmode showcontrols loop ',
'object' => A_attrs.' classid codebase width height',
'param' => A_attrs.' name value',
);
11. Right below that is another listing of attributes headed by this code:
else
{
$allowed_attributes = array
(
'div' => A_attrs.' '.A_TextAlign, // Transitional
12. I added the same code, as I illustrated in step 10 above, to the bottom of that attribute listing, although that may not be necessary. It didn't cause ill effects, so I think even if it isn't necessary, it's ok to have it there also (maybe a php pro could comment on that).
Now, you are ready to paste in your video code (incidentally that example of yours showed nothing even when I put it into a standard html file, but I went to that same site and got another one and it worked fine).
13. When you paste in the html that you get from your video site (youtube or the one you described) you must offset the code with <div></div> like this:
<div>
<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/epUk3T2Kfno"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/epUk3T2Kfno" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>
</div>
That should display perfectly for you.
14. If you would like to add the buttons in your writing/editing box to put in those <div></div> tags, you can put this code into your
/plugins/_quicktags.plugins.php file:
b2evoButtons[b2evoButtons.length] = new b2evoButton(
'b2evo_div'
,'div'
,'<div>','</div>'
,'s'
,'<?php echo T_('Bold [Alt-S]') ?>'
);
Just put that in between one of the other buttons (look for similar code) and you will have a "div" button on your write panel and you are ready to go.
4 edb Apr 01, 2007 02:33
Also a good idea, if you do this, is to remove any "valid xhtml" button or text on your blog (if you have it) because embed is old school. Not that it matters much, but if your blog says it and you're not living up to it, well, you know ... shouldn't say it if it ain't so.
Being into valid code (for no reason other than I am), I tweaked the youtube plugin so that it doesn't use embed on the sites I've linked videos from. I figure it's easier to maintain going forward because when b2evo upgrades I won't need to change anything. When the youtube plugin upgrades all I need to do is compare one file.
5 personman Apr 01, 2007 05:06
You can use the youtube plugin without ever using the search section. Just paste the youtube video id into your post like this:[youtube]3dzAdvv3eb[/youtube]. The purpose of that is to bypass the xhtml checker. It works for several other video services, too. Editing _formatting.php is a royal pain in the ass. I know that from experience and I try hard to not mess with it now. If you're going to make it allow invalid code, you might as well just disable it in the config file and enable the security checker instead. Even if you edit it, your changes will have to be redone after your next upgrade.
EdB, if you'll send me your _youtube.plugin.php file I'll merge the changes into the plugin.
6 stevet Aug 14, 2008 08:00
" If you're going to make it allow invalid code, you might as well just disable it in the config file and enable the security checker instead."
I find if I enable the security checker instead it will not allow me to post multimedia objects.
I wonder if I can uncheck BOTH and dissable ALL HTML in comments instead
7 edb Aug 14, 2008 08:43
You dug up a year-old thread THEN posted your question as a new topic? Thanks!
Install the youtube plugin for videos