May be I do it later. For now I need module based CMS. When module registered in CMS, system search for widget method and if its exists this widget appears in widgets panel.Phil Sturgeon wrote on 03/06/11 4:08 pm:This to me is exactly why HMVC as widgets is a bad idea. Why not just create a Widget class with a method for each widget or a more intelligent system that loads sub-classes and views?
I don't agree. The use of module controllers to produce a widget allows for a very flexible and modular design. What's wrong in this picture is mixing the different usage of modules. Either use them as widgets, in which case you use a front controller that drives your theme engine and fetches the widgets, and you don't allow any routing other than to your front controller. Or use them as routeable modules,but then drop the widgets idea. If you insist on mixing the two, get ready for some serious route filtering, or use a separate 404 controller that you can redirect to from your widget (calling show_404() generates a page, and can not be used in a widget!).Phil Sturgeon wrote on 03/06/11 4:08 pm:This to me is exactly why HMVC as widgets is a bad idea. Why not just create a Widget class with a method for each widget or a more intelligent system that loads sub-classes and views?
Yes, you are right;) For now I hardcoded widget calls in my common template, but I want to make interface to add/remove sidebars and activate/deactivate/uninstall widgets & plugins. Also I will make extention for Group & Acl package for use it with db for manage users rights for enabled plugins... When I do it I will open sources for my CMS and I will open plugins repository for it...Steve Wasiura wrote on 03/15/11 2:57 pm:what do you mean by wordpress plugin's and sidebars?
it sounds like you've already made them.
do you want to allow the site user (i.e. a cms author) to be able to control which widget/plug-in is displayed (on/off) or in which area of the template it is displayed?
This is a part of my moduleHarro Verton wrote on 02/21/11 8:44 pm:Make sure you can't route to it, and it won't be accessable from the URI.
namespace Ideology; class Controller_Ideology extends \Frontend { ... public function action_widget() { $data = array(); $data['pages'] = Model_Ideology::get_widget_data(); $this->template = \View::factory('widget', $data); } }
echo \Request::factory('ideology/widget')->execute()->output();
$r1 = \Request::active(); $r2 = \Request::main(); if ($r1->action == $r2->action && $r1->controller == $r2->controller) { \Request::show_404(); }
Harro Verton wrote on 02/24/11 9:19 pm:Your module is not aware of the way it's called, a request is a request.
If you don't want it routeable, you have to block it in the routes in the config file. You could try comparing Request::$main and Request::$active. If they're identical, you're in the main request. If not, you're in a subsequent request...
if (\Request::active() == \Request::main()) { echo "This is the main request"; } else { echo "This is an HMVC request"; }
if (\Request::active() == \Request::main()) { \Output::redirect('/'); } else { $data = array(); $data['pages'] = Model_Ideology::get_widget_data(); $this->template = \View::factory('widget', $data); }
Harro Verton wrote on 02/26/11 11:57 pm:You can do
If you use this in your controllers action or router method, you have to make sure your 404 controller doesn't require the same module methods, because that would be an HMVC request as well...
It looks like you're new here. If you want to get involved, click one of these buttons!