Recent Topics

Plugins::GetHandledDispModes & Sharing Custom Display Modes

Started by on Nov 17, 2016 – Contents updated: Nov 20, 2016

Nov 17, 2016 15:02    

This explanation refers to when a plugin defined custom display handlers through the hooks:


'GetHandledDispModes'
'HandleDispMode'

If a user wish to have two separate plugins 'share' the same display mode, it fails.
This is because if the same names are defined by two different plugins, the one will overwrite the other.
Please can this be confirmed.

@See _skin.funcs.php

$disp_handlers[$plugin_mode] = '#'.$disp_Plugin->ID; // line 1740

What if there are two plugins that needs to 'share' the same disp mode?

Nov 17, 2016 22:30

Please give a use case example of 2 plugins sharing the same disp mode. Do you want them to both display on the same HTML page?

Nov 18, 2016 07:03

1) I have developed two plugins (which I hope to submit soon). Both these plugins relates to file downloads.

2) The user can control which users, user groups or user level have access to the downloads.

3) They both are meant to work together or independently, meaning they should both share the same disp mode.

4) The user can visit the download page by the same page:

/?blog={blog_ID}&disp=downloads

5) The first plugin can list local files (uploaded with the File Manager).
6) The second plugin can list files in the linked Dropbox account.

7) The second plugin uses the oauth api (included) which the user can link to their Dropbox account. It is developed around Dropbox's new API-2.

8) At this point both plugins are working, but they can't share the same disp mode. The one overwrites the other. This forces the requirement for two seperate disp modes, which makes things messy and confusing, because I designed it so that there is no way for the user to see which file is local, and which is from Dropbox (at the front end).

@fplanque wrote earlier:

Please give a use case example of 2 plugins sharing the same disp mode.

I hope this explanation satisfy your requirement.

@fplanque wrote earlier:

Do you want them to both display on the same HTML page?

I am not sure what a mean by HTML page because that sounds static to me, so I assume you meant that I want them both to display on the same front page, like when calling:

/?blog={blog_ID}&disp=downloads

Nov 18, 2016 16:35

Ok, so on that same (dynamic, not static) page called through ?disp=downloads, what do I see?

  • normal site header?
  • normal sidebar?
  • normal footer?
  • in the middle:
    • one list of files from plugin A
    • below that, one list of files from plugin B?

Is that correct?

Nov 18, 2016 17:10

I am going to answer yes for all of that. Except maybe not the sidebar, but that probably depends on the skin layout settings. But a.t.m it will only show content list by either plugin a, or plugin b. Not both.

Nov 18, 2016 23:48

Ok, if you never need both A and B to display, then I understand how you went down the route of the custom disp.

However, I think the way to go is to make a b2evolution Page and to add a container to that page and then to have 2 widgets in that container, each widget being provided by respective plugin.

Am I making sense?

I guess your next question will then be: how do I make a page with a container only for that page?

  1. Make a custom post type
  2. In the post type settings ( http://b2evolution.net/man/back-office-reference/collections/collection-settings/post-types/item-type-form/ ) enter a custom template name, ie downloads.
  3. Make a page using that post type
  4. Make a downloads.disp.php file in the skin you're using
  5. Include a new container you want in that template

Also, this might actually answer another one of your questions about how to add a new container to a skin... (?)

Nov 19, 2016 10:39

@fplanque wrote earlier:

Ok, if you never need both A and B to display, then I understand how you went down the route of the custom disp.

1) I think we are misunderstanding one another here. I said, I do need both A and B to display, at the same time.

2) I will look into the method that you explained, but then you need to understand that what you explained is starting to become very complicated for the average user.

3) Remember when I said in a previous post (Plugin Development Oppertunaties) that plugins abilities and using them must be simple and stupid, meaning intuitive and easy.

4) I have a client, who wanted to start a new website, so naturally I recommended b2evolution (as I always do) and I even set it all up. Then the client later came back to me saying that b2evolution is too complex. This is the sort of sentiment that people have who are new to b2evolution, and this is the barrier that prevents people from realizing that b2 is such an amazing and powerful platform.

5) This is what I am trying to improve through my plugins, to make it as simple as possible. Almost plug and play. And the method you explained just doesn't seem to be simple and stupid (enough).

6) I want the plugin in to handle everything for the user, all they need to do is install and configure it.

7) I am not convinced your 'solution' is simple enough.

8) why can the plugin not simply allow the sharing of disp modes?

@fplanque wrote earlier:


I guess your next question will then be: how do I make a page with a container only for that page?

  1. Make a custom post type
  2. In the post type settings ( http://b2evolution.net/man/back-office-reference/collections/collection-settings/post-types/item-type-form/ ) enter a custom template name, ie downloads.

9) From what you explained here, the only way that this solution ?(which sounds viable) will work (to make it as simple as possible for the user) is for you to allow a plugin setting (hook) where a custom post-type can be defined. So that the user don't have to do this manually.

Nov 19, 2016 17:44

2) I will look into the method that you explained, but then you need to understand that what you explained is starting to become very complicated for the average user.

I do, but it will get easier in future versions where there will be more pre-built containers and more control over what widgets appears on what disp. Containers+widgets are the long term paradigm we will support. Plugins with custom disps are not.

That being said, remember that in your scheme, you end up with needing to create buttons with custom urls to go to ?disp=downloads. This is not intuitive either.

One thing we could do to alleviate the complexity in the short term, is pre-create (at install/upgrade time) several types of pages with different containers ready to use. So you could just use, say "Custom 3" for your downloads page, and add your widgets to "Container for Custom 3". Is that making sense?

4) I have a client, who wanted to start a new website, so naturally I recommended b2evolution (as I always do) and I even set it all up. Then the client later came back to me saying that b2evolution is too complex. This is the sort of sentiment that people have who are new to b2evolution, and this is the barrier that prevents people from realizing that b2 is such an amazing and powerful platform.

I wish he'd be more specific. But basically b2evolution is a pro/industrial web platform now. If people want just a few pages it's overkill. Kind of like buying a Linux Server when you just want to play Tetris. I'm ok with that. Now if he has pro needs and yet still thinks b2evo is too complex, then I'd be very interested in detailed feedback.

8) why can the plugin not simply allow the sharing of disp modes?

It probably can, I'm not sure, this plugin feature was developed by an external contributor who no longer works on it. It adds shitloads of complexity to the plugin API. There is a decent chance we won't support it in the long term because widgets are much more flexible. Again the central point is: you can put widgets anywhere, which covers the case of custom disps.

Now we just need to make "putting them anywhere" easier. But we'd rather concentrate on that because we need this in 50 other scenarios, rather than working on seldom used plugin API features.

9) From what you explained here, the only way that this solution ?(which sounds viable) will work (to make it as simple as possible for the user) is for you to allow a plugin setting (hook) where a custom post-type can be defined. So that the user don't have to do this manually.

This would again make the plugin API more complex and have a huge impact on maintenance cost of that API. IT will be much easier to have preconfigured custom types that you can use as explained above.

Please keep in mind that the main reason I want to keep this simple is because the simple solution we could deliver in the next few weeks. The complex one could take a couple of years (given our 5000 item todo list).

Nov 19, 2016 20:59

@fplanque wrote earlier:

The complex one could take a couple of years (given our 5000 item todo list).

I really wish your to do list was public. Where we could follow your coding journey. For some, not all, it could be a way that we would understand your efforts better. And who knows, be more appreciative.

I always believe there is a way of doing things better. I might be wrong, but I won't let it stifle my efforts. I love b2evolution. And that says something about all the hard work you contributed, but it doesn't mean I won't expect more.

Thank you for the feedback. Let me explore the options you provided before I comment further on this subject.

Nov 19, 2016 21:14

@fplanque wrote earlier:

I wish he'd be more specific. But basically b2evolution is a pro/industrial web platform now. If people want just a few pages it's overkill. Kind of like buying a Linux Server when you just want to play Tetris. I'm ok with that. Now if he has pro needs and yet still thinks b2evo is too complex, then I'd be very interested in detailed feedback.

Am I understanding you correctly here? It sounds like you telling the average user that b2evolution is not the platform for them. Like you are saying to rather us Wordpress instead? Because Wordpress is much more user friendly? And for advanced uses b2volution is the platform? If this is true, it would be very disappointing because I for one believed that b2evolution is the simple platform that offered so much more.

Nov 19, 2016 23:56

I really wish your to do list was public.

It goes several years into the future and 40% of it may be dropped and never happen. Making it public creates more problems than it solves.

I for one believed that b2evolution is the simple platform that offered so much more.

You think it's simple, your friend seems to think it's too complex. What do you make of that?

As for me I believe b2evolution is the easiest way of running complex websites. But again, if you only need 3 pages, you can find a simpler site builder that has almost no learning curve at all (and I am definitely not recommending WP either).

Nov 20, 2016 08:08

@fplanque wrote earlier:

You think it's simple, your friend seems to think it's too complex. What do you make of that?

It's a matter of perspective, I understand php, JavaScript ect and have been using b2evolution for some time now (somewhere since version 3 I think) and look at the source files of almost every release.

I have asked for help and advice here on many occasions. So yeah, to me it's simple in comparison. I am familiar with b2evolution. I like complex things. I like that there is more than what meets the eye.

With all of that said, to the newbie it's very overwhelming.

Thousands upon thousands of websites are registered and when people stumbles on b2evolution they probably run as fast as they can to joomla or Wordpress.

It's the same reason that users who are running old, outdated and even obsolete versions of b2evolution kick against the idea of upgrading. Its just too much effort.

And when you think about it you realize the reason why people prefer other platforms is because there are tons of support for it, be it tutorials or video guides. Web developers recommend it because there are a great selection of skins and plugins to choose from. It provides what people want. Options.

Developers love Wordpress because they can create plugins and skins and make a decent living form it. There are markets where these items can be sold. It stimulates both development and entrepreneurship.

So what about b2evolution? This is why I requested to enhance plugin development Oppertunaties.

1) Why can't plugins alleviate some of the pressure and configure some settings on behalf of the user?

2) Why is it that the dev mandate seem to kick against the idea of making b2evolution more user friendly and allow a space for people who wants to start off with a simple website that perhaps only have one or two pages? (But yet leaves space for allowing it to grow into something bigger and more complex?)

3) Why does it seem that b2evolution has this policy that if it isn't part of the core it doesn't fit with the core - meaning that there is little flexibility for developers to step in, design plugins for b2evolution that people want, is easy to use and can help devs make a living? And in doing so make b2evolution popular and widely used.

As it stands, what the plugin 'system' allows is very limited and restrictive.

Nov 20, 2016 16:42

Ok I hear you. I'm gonna have to let this sink in a little before I reply ;)


Form is loading...

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