correct code question - how to use plugin class file correctly in plugin? #5180
Unanswered
Jimmi08
asked this question in
Q&A Plugins
Replies: 1 comment 1 reply
-
I'm sure you know that Use e_module.php to load your required file. It now is available for any page. on your plugin page create a new instance for your class. on your menu create a new instance for your class. This doesn't load the class script twice. If you want to be nice, use |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I looked at core parts and plugins (f.e. vstore) and there are too many different solutions.
I would like to stick with one and use it in all my plugins.
What I need to know:
In the old way, you would include/ require this file.
vstore is using in single page
/** @var vstore $vstore */
but menus use:
so if the menu is on vstore page, there are 2 vstore classes?
if I use getSingleton() in e_module, should it be available everywhere and with e107::getSingleton('vstore')->anymethod?
The forum plugin is using
and in menu
Could somebody explain this to me? I vaguely understand the concept (e107 is using Singleton pattern, I know), but what is new code and what is legacy stuff? Why menus are not using e107::getSingleton() too?
And why in some cases is e107::getObject() used and not e107::getSingleton()?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions