[Solved] PluginController 'incude_once'
|
70 posts
|
Hello, I’m currently writing on I hunted down PluginController.php line 68 to use ‘include’ instead of ‘include_once’. Can someone please change this? Thanks |
|
651 posts
|
What exactly is your problem? Can you describe it please? Then I’d have an idea why you want the change, not that I’m opposed to the change by the way. |
|
70 posts
|
Sure this is my plugin/index.php
And this the init method:
The idea is that the controller takes care of the plugin handling. I have the plugin_id also as a constant and do not want to repeat it in plugin/index.php and in plugin/controller.php. Therefore I use this code:
Hope this clarifies it a little bit. |
|
651 posts
|
I understand where the problem is coming from…. I must say I didn’t expect anyone to try and write their own plugin controller instead of just using the normal method to initialize the plugin. I also don’t entirely understand why you would want to? That just makes it needlessly complex? What you want to do in the controller doesn’t belong there in my opinion… it belongs in the index.php file. That’s how it was designed and there is a reason. You could have multiple controllers in a single plugin for example. That would become rather difficult in your scenario. |
|
70 posts
|
You got me wrong. I’m writing an admin controller. Therefore I have a controller anyway and I use the provided controller.
Not necessarily. I can show you the complete plugin once I’m finished.
Ok, the way I had it before was plugin/index.php:
But as you can see, the class is also included because I access the constant, so I’ll run into the same problems.
I’m not saying that this method should be used in any case, but for simple plugins I think it’s elegant. But either way, if I access the constant from the plugin/index.php I get the same error. Therefore, please change from ‘include’ to ‘include_once’ in PluginController. |
|
70 posts
|
Issued an official feature request. |
|
651 posts
|
I’ll implement the change since its not a real big thing and generally makes Frog more robust.. but as a programmer I must say you seem to be doing a whole number of things just to prevent yourself from having to write the plugin id twice… doesn’t make sense to me. |
|
70 posts
|
Thanks Martijn, well, it’s not only the ID. It’s also the registering of the observers and the admin tab as well as the version information ;) I’ll change this behaviour (maybe) for the next plug-ins ;) Have a save trip to Japan |