WildcardSearch / Advanced-Sidebox

A plugin for MyBB forums that displays custom boxes on various forum pages.
GNU General Public License v3.0
20 stars 10 forks source link

invalid html output when sidebox content empty #4

Closed avril-gh closed 11 years ago

avril-gh commented 11 years ago

I have found that when content of sidebox is empty then nothing is output within sidebox's tags, which then is seen as invalid html by W3C validator because there should be at least something like

It may happen in any situation when user not provide any content by himself, or something prevents this content from being shown. (eg. content may no more exsist (was deleted), user may have no privilages to view it, ect) Good example of this is 'private messages' module, where if user is not loged in, then ofcourse there are no messages for him as guest, and then content of sidebox is empty which is output as invalid html (nothing here)

As always there are many solutions to this. If there is no content for sidebox then content may be set to or simply whole sidebox may be not displayed. However, as there are many users, there are same many expectations from them on how it should work.

This is why i think that most universal solution would be, 'give user choice on what should happen when there is no content within sidebox' by adding option in configuration->settings->advanced sidebox 'display empty sideboxes ?' 'yes / no' and then - When 'yes' enabled - empty content would be replaced and output as When 'no' enabled - sidebox without content would be not displayed at all.

Good opportunity to turn 'bug' into 'new feature' hehe.

WildcardSearch commented 11 years ago

This certainly needs to be addressed. Using the current system the main plugin file calls methods of the Sidebox_addon object $modules and doesn't have access to whether or not the module had content or is just an empty box.

So any change here would need to be made in the individual modules themselves. Perhaps add one setting as you have suggested and then have each module contain a default 'nothing to display' message tailored to the specific module and also check to see if it should display anything at all.

It would be relatively simple to do but require a bit of time. I am off tomorrow so I will try to dig in and get some of this going.

Do you really think the setting is necessary? I kind of think we should really just make a decision and go with it and then if people complain then address it then. No need adding more work for something that turns out to be a non-issue.

just my thoughts

avril-gh commented 11 years ago

Do you really think the setting is necessary?

I agree with you all the way. Whats important here is only fact that 'at least something like should be within tbody tags' regardless from if there are any content or not - to maintain valid html structure. and thats it.

The rest was just my common way of thinking forward, far beyound the current problem, which always help me to avoid dead ends later, where its more easy to scrap something and remake from beginning, than add new features, because of not flexible design which didnt predicted such things much earlier.

But more i think about it, more choices, possibilities, and things i see out there, like displaing boxes depending on group permissions ect, which could blend nicely with this and many other possible things (why display login box to logedin user? should display admin only box to everyone?)

While these ideas are still in shadows and need for them is not even fully grasped, its really better to concentrate on 'tbody' issue and leave topic about 'what, why and from who to hide or not' until it mature enough, or we will end up later with 100 separate show / hide options all having the same functionality but different name.

WildcardSearch commented 11 years ago

I think we are in agreement then.

I will work on ensuring the HTML produced is valid and keep in mind that I may have to edit that code later to include a setting check and so keep it flexible.

Will update when I make progress.

WildcardSearch commented 11 years ago

Okay I think I have got this solved. Let me know if I missed anything.

Cheers.

avril-gh commented 11 years ago

I saw there something not rite in html (which i will continue to test), but for a moment while testing private messages box, fiew things within it caught my attention and it end up in improvements in this module.

I think i just finished with private messages module for now, and will post it as update to not forget, then im back to continue testing html and stuff. (in fiew minutes there should be new report about private messages box update)

WildcardSearch commented 11 years ago

Okay just let me know if this issue is fixed or not whenever you have time. I will look myself again, but I think you have a better eye for HTML than I do.

Cheers

avril-gh commented 11 years ago

Ok, pm's block has been fixed in other report. Im goin back now to checking html which i mentioned in previous comment.

WildcardSearch commented 11 years ago

Cool. Let me know if you find anything else.

avril-gh commented 11 years ago

fixed at #11