Recent Topics

1 Mar 05, 2007 19:44    

My b2evolution Version: 0.9.x

I have tried about everything logical tweaking _formatting PHP to allow the typical You-Tubeish code of <object><param></embed> on both my current version .9.0.12 and the latest 1.9.2

Looks at all the other posts on the subject but none seems to work. From .9 version I keep getting "object is not allowed..." and I can't event get it to work on new version (insists object has to be within other tag, etc...)

Can anyone help me to get this working? Was there some bug in the older version of .9 that doesn't allow these tags under any circumstances. Here's my _formatting.php file (or at least the relative parts I've changed). Thanks for any help.

// Array showing what tags are allowed and what their allowed subtags are.
$allowed_tags = array
(
	'body' => E_Flow, // Remember this is not a true body, just a post body
	'div' => E_Flow. ' object',
	
	'p' => E_Iinline.' object embed param', // NJW MOD - add for youtube

  'object' => E_Iinline, // NJW MOD Add object param embed attributes
	'param' => E_Iinline,
	'embed' => E_Iinline,				
);

// Array showing allowed attributes for tags
$allowed_attribues = array
(


	'object' => A_attrs.' classid codebase width height', // NJW MOD Add object param embed attributes
	'param' => A_attrs.' name value',
	'embed' => A_attrs.' src type wmode width height',		
);


Any help is appreciated....

2 Mar 06, 2007 10:59

I went through days of similar frustration and eventually came to the conclusion that I could work with less. I use <iframe> and <embed> quite a bit and those are working just fine for me as was discussed in another thread (which is mose likely one of those you have read), but by always doing my html in the simplest way possible.

I display youtube videos without difficulty.

Although it doesn't solve your desire to achieve the <object><param><embed> nest provided in the copy and paste html provided by youtube, if your objective is to merely display youtube videos in your posts, then you don't need all of that. Simply copy in that html which you have grabbed from youtube and then carve out the <object> and <param> tags (you don't really need them) and all works well, as follows:

<div>
<embed src="http://www.youtube.com/v/Gj_-cbgR72g" type="application/x-shockwave-flash" width="425" height="350"></embed>
</div>

I did that like this (in the _formatting.php file):

'div' => E_Flow. ' iframe embed', 
'p' => E_Iinline. 'embed ', 

Plus, I added this for the attributes for embed:
 
'embed' = > A_attrs.' style id align type src quality bgcolor scale wmode salign', // Transitional 

NOTE: <embed> now works inside both <p></p> and <div></div>.
(I tried doing iframe also with <p>, but that didn't work, so I just use it with <div>).

As I illustrate, for the b2evolution html checker to work, you are going to need to have your embed tag able to nest under <div> or <p> (or maybe you could use something else, but these work just fine). That is explained in that other thread, which I'm sure you read, because this is the same method you are using, you just didn't show the <div> illustrated with <embed>. (Incidently you need to turn off smilies in your posts here on this board, if you don't want the => to turn into graphic right arrows).

So, if your end result is merely to display youtube videos in posts... then this is the simple solution (it works great!). However, if for some reason you must have the entire <object><param><embed> nest, then (like me) you will need to wait for more expert php help. The method I'm using certainly gets the youtube videos in there and that is all what I wanted.

3 Mar 06, 2007 19:06

Ok, I got it to work...

You just have to add these in the "allowed tags array" section, in addition to those other changes already discussed, including those for <div>:

// Array showing what tags are allowed and what their allowed subtags are.

$allowed_tags = array 

'object' => E_Flow.' param embed',
'param' => E_Flow.'  embed',

Also I used those attributes for object and param as you indicated in your post able in the  

 $allowed_attribues = array: 

I am now able to display videos using the entire youtube suggested html as follows:



<div>
<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/Gj_-cbgR72g"></param><embed src="http://www.youtube.com/v/Gj_-cbgR72g" type="application/x-shockwave-flash" width="425" height="350"></embed></object>

</div>

Yeah!!!

Maybe I should do a summary of all the changes or upload my _formatting.php file. Let me know if the steps aren't clear.

5 Mar 06, 2007 19:19

¥åßßå, I could not find a youtube plugin that worked, but maybe I didn't find the right one or do it correctly. That youtube plugin you suggested, adds a search of youtube into the b2evo backoffice posting form, but, I prefer doing my searching on the youtube site itself and just copying out their suggested html. Plus, it's nice to have these added <object><param><embed> tags for other uses (there's life beyond youtube and similar services).

Also, on this forum, someone said that adding plugins can slow the execution of the program, because the server is being taxed (just bs?).

I don't know it that's true, but, I have always been looking for ways to do things without plugins after I read that. It sure seems like an elegant solution just to have a nice clean _formatting.php file that does the trick (but, like I have said, I am a rank amateur on this stuff).

6 Mar 07, 2007 00:17

I've no data to support server loading from multiple plugins, but people can and have cured the 'blank page' problem by shedding plugins. Something about the amount of memory it takes to think about them all compared to how much you have available. When I do an installation I simply delete all the plugins I'll never use. Mostly all the various renderers that let you use shortcuts to get tags like bbcode and gmcode. It's good that they exist, but if you don't want them it's easy to delete them from your server.

Anyway the drawback to hacking is when you want to upgrade you'll have to rehack your stuff. It used to be the only way, and frequently a hack wouldn't work in the next release because of a change in something the hack was taking advantage of.

The place you're hacking at currently seems like it would have been no problem to carry from long ago to now, so it's probably safe going forward. No promises on that though is the thing with hacking.

7 Mar 07, 2007 09:36

Edb wrote: Anyway the drawback to hacking is when you want to upgrade you'll have to rehack your stuff.

Yes, I agree with you. This consideration was a primary reason I was anxious to get the ability to insert the very effective <iframe> html tag, complete with any of its attributes, into any post. I have found that employment of <iframe> to be the very simple solution to all my needs to add any desired special effects to my posts. I use <iframe> to "call" my own customized html files, exactly the same way I use images.

For anything which I wish to show or "effect" inside a post, I can accomplish whatever I want (so far at least) with those separate html files (sometimes with nice javascript effects). Other times I might wish to display something written in perl or python. Sometimes just having information (which might need to be updated from time to time) in a scrolling window is very desirable.

I just create inside my blog directory, a sub-directory called "files," in the same fashion as I created a sub-directory called "images," where I place any images I want to use in a post. I then stick my newly written html files, which show whatever I want, into that "files" directory (sometimes they might just redirect to a perl script, for example) and then I "call" them as needed (with merely the appropriate url) to appear inside the the <iframe> envelope in any post. I have scrolling off or on depending on what it is I am needing to display. Using my customized html (perhaps with its own javascript) in separate files allows me to write without any html (or js) restrictions inherent in the B2evo application, plus I am free from being caught with upgrade lockout that comes from trying to hack the program (all I would have to do is transport my <iframe> hack (unless the <iframe> capacity becomes standard in future versions).

Since anyone doing the b2evo blogs has to have remote server access, creating a "files" directory remotely is not a problem, so the <iframe> method represents a very clean way to enable anyone's blog postings with vast capabilities without any complexities (and you don't have to learn php to do it). Of course, if a user isn't proficient in creating html pages and doesn't know how to incorporate javascript then this isn't so much of an option (except for maybe very simple special information html files they might want to scroll).

Another distinct advantage of this <iframe> method is that it follows the basic coders ideal object oriented programming (OOP) rule of "write once, display (or run) everywhere." I can "call" the same information (or display or effect) in literally hundreds of posts all over my blogs, and if I ever need to change that information, I just go to one place to update it and the new iteration appears in all of the previous postings (exactly the way everyone now does with images).

My point is that <iframe> shouldn't be regarded like that crazy aunt you have to keep in the basement, but should be promoted and described as one of the basic tools for good blogging.

8 Mar 13, 2007 03:11

// Array showing what tags are allowed and what their allowed subtags are.

$allowed_tags = array

'object' => E_Flow.' param embed',
'param' => E_Flow.' embed',

Also I used those attributes for object and param as you indicated in your post able in the

$allowed_attribues = array:

this code shown above have an error: collapsed my b2evo !

9 Mar 13, 2007 05:30

azarober wrote: ...this code shown above have an error: collapsed my b2evo !

Well, I'm not surprised. You can't just poke in code willy-nilly!. If you read this entire thread you will see that there are several bits of code that need to be put in other than what you saw there.

This works beautifully. I will describe the sequence for you so you don't have problems.

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 then added the same code ...to the bottom of that attribute listing as I illustrated in step 10 above, 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).

13. That's it. It should now accept your youtube html code pastes in a post and show the videos. .

Before you attempt all this.... I would suggest you check out the youtube plugin that is recommended above by ¥åßßå. This is a lot of code changing... it shouldn't be attempted by those who aren't practiced hackers (we are, appropriately, a very disgraced group by the real php coders like ¥åßßå). Plugins follow along with upgrades (or you just get the new version). Hacks like this... will be obsolete with a new version. My advice is to stay away from this kind of a fix unless you are used to messing around with other people's code.

OR, do this instead:
Another very simple way is what I described in an early post in this thread to simply incorporate the <embed> tag to run inside of the <div> tags, along with a simple attribute line and then strip out everything from the youtube code except what's inside the <embed></embed>. Check out that earlier post, it's simple (originally explained in a post by stk, located here: http://forums.b2evolution.net/viewtopic.php?t=7344 ).

10 Mar 13, 2007 08:38

You are right... is not for me..... I simply disabled
html_checker.... that's all

11 Jan 02, 2008 18:46

samredman,

**dusts off old post**

Thanks for the info above. I had tried this awhile back and revisited just now. It does not appear to work for the v.9 series. (I know, quite old - upgrading ATM is not an option).

It certainly *looks* like it should work. Was there perhaps a step left out, or is there a known issue with the .9 series not accepting object tags no matter what?

_________________
EDIT:
BTW, also tried just doing "embed" tag with object/params and I still get the same error message:

"Illegal markup found: object"

Is it referring to an object tag (which is not present) or some other object?

12 Jan 03, 2008 04:08

The entire 0.* generation is obsolete. If upgrading is not an option then you must accept that getting support is also not an option.

Sorry, but that's the way it is.

(time to lock this dusty old thread?)

13 Jan 03, 2008 14:58

Thank you for the terse reply, however it does not answer my question, which is referencing the settings above:

Was there perhaps a step left out, or is there a known issue with the .9 series not accepting object tags no matter what?


Form is loading...