Recent Topics

1 Feb 25, 2007 00:46    

My b2evolution Version: 1.9.x

I would like to add some html tags which are not currently supported. Is there a way I can simply add those?

Most desired for me is <iframe>, but also <embed>. In phpbb (the software this board is) the mechanism is for adding is simply a matter of putting the code into a list located in their admin panel (with each new tag separated by commas). I have looked for such a thing in my B2evo admin panel, but I can't find it.

Is there a place in the admin panel for b2evolution where I can add html tags? Or is their a plugin which will allow the one's I wish? I would also like to see a listing of all of the html tags currently supported (of course, I find them out pretty quickly by trial and error).

I have searched in the online manual and in the phpbb search mechanism for information about adding new html tags... but to no avail.

2 Feb 25, 2007 01:14

There is such a list. It´s in ../blogs/config/_formatting.php. You´ll need a little php knowledge to add new tags, but look for similarities and you´ll grasp the idea.
For certain <embed> items you could better look for a propriate plugin to get done what you want.

3 Feb 25, 2007 02:34

That _formatting.php was very helpful (the path to that file was different on my 1.9.1 installation from what you showed, but it was easy for me to find).. I learned quite a few html tags which I could apply, such as table (I made several nice tables) and the various headline tags for different font sizes. It is quite strict regarding requiring lowercase on some tags, but not on others. But, there is quite a nice collection there. That would be a useful addition to the FAQ's. After I play with them all (and learn their idiosyncracies) I will prepare such a listing and example usage for the FAQ topic of this forum.

I tried adding the iframe tag using the same syntax as some of the other allowed codes in the same locations as the others appear, but to no avail. It still says that's illegal when I try it in a post.

I would like to find out either how to add the <embed> or the <iframe>. Those would be very useful.

4 Feb 25, 2007 04:30

Enabling <embed> and <iframe> is the easy part: juat add them in the appropriate array. The tricky part are the attributes you want <embed> etc. to allow. They are nested in a complex way, like: E_inline == a + E_special + + E_fontstyle + E_phrase and E_phrase == E_phrase_basic + E_phrase_extra and so on and so forth.

In 1.8.x I had a problem with a table that didn't allow rowspan. That was easy: I added rowspan after colspan. This was a minor bug. You will want to think of all the attributes <embed> needs (id is one) and define them.

Once again: you'd brtter check the plugin section of the B2o site to find what you need.

I'll add this dirty trick: in the _formatting.php file you find at line 36 onwards:

 * Validity & Security Checking
 * Posts and comments should be checked to see if they contain valid XHTML code
 * and no invalid code (javascript, styles, CSS, etc...)
# Html checking will validate posts and comments to a subset of valid XHTML.
# This will also do much cleaner security checking than the next option.
# Note: This option requires the PHP XML module. If your PHP installation doesn't have it
# disable html_checker and use security_checker.
$use_html_checker = 1;
# Security checking will check for illegal javascript hacks in posts/comments
# and for CSS in comments. However, this may be a bit harsh on your posts :]
$use_security_checker = 0;
# WARNING: disabling both $use_html_checker and $use_security_checker is suicidal !

You could temporarily disable the html checker and play around with your embed and iframe.

Good luck

5 Feb 25, 2007 05:16

I think that I will let <embed> go for a while, because, as you say, there are quite a few attributes that might be needed. The things I want <embed> for are indeed covered in some existing plugins ( to playyoutube and google videos).

But, the <iframe> is much simpler and hopefully I can get that to work.

All I really need for <iframe> are src height and width.

Here is the html code that I would want to enter:

<iframe src="" width="240" height="300"></iframe>

I have entered everything, (at least as it seems to me) appropriately in the _formatting.php file, but it still doesn't work.

The error I am getting now is this:

Tag <iframe> must occur inside another tag

If I put it inside any other tag I can think of like <table> for example (something which would represent appropriate coding on a conventional html page, I get this message:

Tag <iframe> is not allowed within tag <table>

I also tried it inside the <center> </center> tags, but got this:

Tag <iframe> is not allowed within tag <center>

6 Feb 25, 2007 05:27

This is a guess: add iframe in the "table" attributes (like rowspan).

In your first example you forgot the tag "src".

You could setup a second blog for test purposes - i mean a complete second installation of b2o on another location. Use this blog as a testblog and disable the html chsck. If you can get <iframe> to work, then try adjusting the _formatting.php file until it work with the html check enabled. You might encounter other problems, like I had when trying to add php in posts. It's simply not possible. It would be disappointing to work for a few days on a solution that doesn't work anyway.

Good luck.

7 Feb 25, 2007 13:05

I edited my earlier post to add the src (the omission you pointed out in your post) to the list of attributes that I would need for iframe inclusion.. I had already been playing with mimicking the code for the img tag and the table tag (those seemed similar) and have been including "src height and width" (but, like I said, no success yet).

About making hacks into code that you don't really have a clue about, I have a method that keeps disaster away. I can make changes at will on an experimental basis without fear that I might destroy the program irretrievably. What's nice is that it doesn't require a second installation of b2 to do it.

Anytime I want to mess around inside of a server file that I really don't understand the language (like php or python or perl) and even if I am messing with even my own original html files (which can be rather daunting at times), I create a system of safe backups that let me always quickly go back to something that works.

I could really write a guide called "How to hack inside server code you know nothing about," because, I have been doing this for years and literally hundreds of times I have been successful in achieving my goals, while I remain ignorant of how to code in those various languages.

Here is what I do: Before I start messing around I copy the working file (back it up) and name it, appending with the word SAFE and a number. For this experiment I did, for example, _formattingSAFE1.php. Then I begin making whatever edits I wished in the current _formatting.php file (on my own computer). When I am finished with my butchering, I just overwrite on the server side and see how it runs. If what I did crashed the program (happens a lot), I just copy back my SAFE file (changing the name as I copy to the original).

If my changes worked, I make a backup copy of that called with SAFE2 added (as _formattingSAFE2.php, and so on, in sequence). This way I end up with a series of historical working copies, any of which I can go back to.

What is nice about this method is that ofttimes the error handling is so good (as it is with php) that when you do get a crash, on-screen you will get an error message telling you what you did wrong and on what line the error occurred. You need to use a good programmer's editing tool, like Ultraedit, to make your changes, which will easily let you find that line number for you to examine where you messed it up. With this approach, complete crashes of the program never bother me, because I simply immediately restore my last SAFE version and I am back to normal.

I have used this method extensively (for the past few days) with b2evolution to make adjustments on my skin php files (primarily the _main.php) with excellent results. Of course, the purists (those who really know what they are doing) will tell you not to try to mess with code you don't understand, but I can't help myself. And so very often I achieve exactly what I am looking for.

But, my efforts to add the currently non-supported <iframe> have been ineffective. Hopefuly, an expert php pro (like EdB) will give an old hacker some guidance here.

8 Feb 25, 2007 14:41

See if the explanation for making embed work here helps you figure out how to make iframe work. No promises though because I use a PC and therefore can't use iframes (or ipods or iphones). Get it? It's an apple joke. ha ha?

9 Feb 25, 2007 16:11

I have <iframe> and <embed> working now, but certainly not elegantly.

That was an interesting link about embed and that thread sounded like the problem is solved and it should work. But, I couldn't get it to work with those changes unless ( as Afwas suggested earlier in this thread) I turned off both the html_checker and security_checker in the _formatting.php file as follows:

$use_html_checker = 0;
$use_security_checker = 0;

If I turn either of those on, it gives the error messages (and others) that I listed in my first post.

With those both off, his method works. But even my hack changes did too, (where I mimicked the img tag formats) with the two "checkers" off, enabling both iframe and embed to work perfectly.

I was able to use the full attributes listing for iframe, as follows:

'iframe' = > A_attrs.' src id class title style align width height frameborder longdesc marginheight marginwidth name scrolling ',   // Transitional 

I also did it for <embed> with these attributes:

'embed' = > A_attrs.' style id align type src quality bgcolor scale wmode salign', // Transitional 

I was able to embed a youtube video (works great) in a post with this html:

<embed src="" type="application/x-shockwave-flash" width="425" height="350"></embed>

So, it now works great for me (But, how risky that is I don't know (that suicidal warning sounds scary), so my guess is that there needs to be a better solution (or I didn't do the stk solution correctly).

10 Feb 25, 2007 18:57

The link from EdB suggests you can get it to work with the HTML check on (1). You didn't mention the early steps stk suggested in his post (in the other thread):
stk wrote:

'p' = > E_Iinline,

and change it to

'p' = > E_Iinline.' embed ',

(make sure it's the original COMMA after E_Iinline is changed to a PERIOD)

stk embedded the embed tag in a <p> like I suggested you could embed the tag in a <table>.

You also didn't mention the second step of stk.

Well, if it works with the html checker off, you know your work will not be in vain. Just keep on editing the _formatting.php file until it works also with the checker 'on'. is a link to an external site describing the transition from an embed tag to an object tag. As mentioned by stk, I suggest you give that a try also. The <object> tag is xhtml validated and should work with the checker on.

11 Feb 25, 2007 22:42

Ok, both <iframe> and <embed> are now working in the posts with the html checker set to 1. Security check is still set to 0 (which evidently is the default setting). I had done all the steps described by stk, but I didn't do that "period, instead of the comma" and that one omission kept it from working (thanks to Afwas for patiently pointing that critical syntax out for me. That made it work).

So, I then, after your post, I followed stk's instructions to the letter (putting in that period). Additionally, I inserted two attributes, type and wmode, to "embed" to make pasting in html from youtube easier because they include those in their suggested code. That's how I knew for sure that the html check was now "on," because it alerted me with an error message that the attributes, "type" and "wmode," weren't supported for embed. I added them, and now everything is working great.

Here is how I now show a youtube video in a post:

<embed src="" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>

For the iframe, I just duplicated those exact same "embed" entries as outlined by stk for embed, but with iframe entries. Of course, I used the appropriate attributes specific to iframe (as I described in an earlier post)..

What is nice is that this is all done with just the _formatting.php file without plugins. Thanks for your help Afwas and Edb and, of course, stk. Here is that link to that stk solution, repeated just easier reading,

12 Feb 28, 2007 00:10

Well, I actually spoke too soon about getting both the <iframe> and the <embed> to work... I did actually have them both working, but I realized later that not both at the same time.

Evidently, you can't have them both assigned to be subtag for <p>, it appears that it is one or the other.

So, to get both embed and iframe to work at the same time (even in the same post), I just followed the same instructions as stk outlined for embed, with the exception that I made <iframe> as subtab for <div>, but like this:

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

Remember to put a period rather than the original comma.

Embed is now done inside of <p></p> and iframe is done inside of <div></div>

If any one is interested in this and can't follow what I have described and need to see the a,b,c exact steps (or wish to have a copy of my _formatting.php file), let me know, by posting here.

After you have made the _formatting.php changes, here is how you would do both:

<embed src="" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>

<iframe src="" width="450" height="200"></iframe>

13 Feb 28, 2007 00:22

what about :-

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


14 Feb 28, 2007 02:16

¥åßßå wrote:

what about :-

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


Great news! It works better, but not all the way.... (however, good enough for my needs).

samredman says:

The results:
Using ¥åßßå's suggestion:
- iframe works only inside <div></div>, but not inside <p></p>.
- embed now works inside both <p></p> and <div></div>.

You are on the right track. Probably needs one more tweak.

I tried doing this in addition in the "$allowed_tags += array" area:

'iframe' => E_Flow, E_Iinline,
'embed' => E_Iinline, E_Flow,

but, the results were the same.

Like, I said, I don't know anything about php. I am just a guy who pokes and prods and copies other people's suggestions... so if this can be refined just one more step then it is worthy of it being called a really good solution (but, like I said, your latest improvement makes it just fine for me... I'm easy).

15 Mar 08, 2007 00:48

In my Blog, I would like to post regular text and, JavaScrit tags, in order to perform some operations, like insert a Google Adsense advertising.

How can I do that?

16 Mar 08, 2007 17:36

The simplest way is to amend your skins _main.php to include your google ads within the post loop. If you search the forums for google ads there should be several posts talking about ways to achieve this.


17 Mar 08, 2007 19:33

I made it, by creating an .htm file where I pasted the addon JavaScript Code, and incluind it on the main.php <?php include"filename.htm" ?>.

Thank you very much for you help! :D

Form is loading...