Recent Topics

Tag <div> is not allowed within tag <p>

Started by on Mar 01, 2010 – Contents updated: Mar 01, 2010

Mar 01, 2010 07:49    

My b2evolution Version: Not Entered

Chrome 4.0.249.78 unknown (36714)

OS:Vista sp1
CMS Version: 3.3.3
Apache Version : 2.2.11
PHP Version : 5.2.11
MySQL Version : 5.1.33

No urls, B2 is being tested on my local.

1) deleted all sample blogs
2) created new blog called test, accepted all defaults
3) added images via file manager
4) edited my first post and added one image via Add/Link Files
5) click save

I get this message:

Tag <div> is not allowed within tag <p>
(Note: To get rid of the above validation warnings, you can deactivate unwanted validation rules in your Group settings.)
Invalid content.

Is there a reason B2 has to behave like this?

I know how to fix it, but if my potential clients see this every time they add their first image?

Mar 01, 2010 14:05

Are you using tinymce or just auto-p?

Can you post the html for your edited post?

¥

Mar 01, 2010 14:20

¥åßßå wrote:

Are you using tinymce or just auto-p?

Can you post the html for your edited post?

¥

Hi,

I'm using all default items, no plugins, or that I can remember during install there were no check box options to install tinymce.

HTML

<p>test</p>
<div class="image_block"><a href="/b2evolution/blogs/media/blogs/blog/cute omnomnom_1280.jpg"><img src="/b2evolution/blogs/media/blogs/blog/cute omnomnom_1280.jpg" alt="" width="1280" height="1024" /></a></div>
<p> </p>

I discovered that after saving, and getting that error message, if I switch to
simple tab or vise versa and hit save, the error would not show, and I'd get the following HTML:

<p>test</p>
<p> </p>
<div class="image_block"><a href="/b2evolution/blogs/media/blogs/blog/cute omnomnom_1280.jpg"><img src="/b2evolution/blogs/media/blogs/blog/cute omnomnom_1280.jpg" alt="" width="1280" height="1024" /></a></div>
<p> </p>

Mar 01, 2010 16:26

Hmmm, I'm guessing that you're using version earlier then 3.x and it's the auto-p plugin that's causing this.

Depending on your version you might like to try 2.4.7 or 3.3.3 and seeing if either of those work better

¥

*edit
Ack, just noticed that you mentioned you're running 3.3.3 in which case you should see tinymce as it's a default for all users. Check your user settings ( admin > users > your user [probably admin :p ] ) and see if you have tinymce enabled.

Mar 01, 2010 17:14

¥åßßå wrote:

Hmmm, I'm guessing that you're using version earlier then 3.x and it's the auto-p plugin that's causing this.

Depending on your version you might like to try 2.4.7 or 3.3.3 and seeing if either of those work better

¥

*edit
Ack, just noticed that you mentioned you're running 3.3.3 in which case you should see tinymce as it's a default for all users. Check your user settings ( admin > users > your user [probably admin :p ] ) and see if you have tinymce enabled.

NOT enabled, I checked it and tried again, now I'm getting more weird issues. Surprised no one's experienced this.

Mar 01, 2010 17:25

At least that rules out tinymce :D

Ok, what are your other problems, maybe they're related?

Also, might be worth grabbing a fresh copy of the zip in case you have a borked file.

¥

Mar 01, 2010 18:07

¥åßßå wrote:

At least that rules out tinymce :D

Ok, what are your other problems, maybe they're related?

Also, might be worth grabbing a fresh copy of the zip in case you have a borked file.

¥

Reinstall results in the same issue. Not sure what's going on. If I have time, I'll get more details.

Mar 02, 2010 02:29

I have the same problem when adding an image to a post. However it wasn't reported because I simply use a work around solution - switching to HTML mode to edit the tags and switch back to WYSIWYG mode to continue with editing.

I just realized that there is TinyMCE option after reading this. I thought it's the default WYSIWYG editor in expert mode! After reading this, I went to check my user setting, it's unchecked. And my editor does seems like TinyMCE editor, unless my eyes fool me it's a different editor but looks like it - how do you check what editor is being used?

Mar 02, 2010 18:18

The thing is, the validator is correct <p> cannot contain block level elements. If it's caused by tinymce being used then it's probably a bug ;)

There is only one editor that ships with evo ;)

¥

Mar 04, 2010 12:57

Could this topic then be moved to the bugs section?

Because it's seems it's a bug in b2evolution how it's adding the image div tag inside the paragraph tag rather than a bug in tinyMCE.

Mar 14, 2010 18:38

Arg, this is super hard to fix ! :p
I gotta check back on that but I think there is a button somewhere in Tiny MCE that says sth like "Clean up the code". That should fix this.

Mar 14, 2010 20:50

Just change the wrapper to a span?

¥

Mar 15, 2010 13:23

Sorry to hear the bug is hard to fix.

Your solution about the clean code button seems to work but we have so many users in our blogs and more are coming that it isn't really a usable solution to force everyone to clean up the code before saving it.

I haven't checked the CSS code but why do we need the extra div around a image? Can't you just add the needed CSS class to the img tag itself? Or maybe the span solution. :)

Mar 17, 2010 19:59

Yes, we should probbaly do the span solution.


Form is loading...

powered by b2evolution – This forum is powered by b2evolution CMS, a complete engine for your website.