2015-07-04, 07:17:19
(2015-07-04, 02:32:01)HelgeSverre Wrote: I am also trying to bring some sort of "mvc"-structure to my plugin, where as you call controllers within the plugin instead of doing the procedural spaghetti-mess I am doing now in the main function, but I don't know if that is the best way to do it.
Do you have any recommendations in this regard?
The code looks like neat OO already (more than mine), and given the size of it (2 files, 200-400 lines) I doubt it will bring substantial benefit. Always good to separate concerns though; you could put the form HTML in a separate file
view.php
& include it in main, and as you suggested in comment (eg in controller.php
):Quote:Move a lot of this logic into a "controller" class, leaving this method as only a routing function
The model you already have -
PluginInstaller.class.php
. Feel free to have a look at my code for GS Custom Settings, although for PHP I think I have more to learn from you (I develop mainly JS MVVM (KnockoutJS)).