How to make a widget or window system

Hi there,

How can I make something which will be accessable by actions and whereby a specified controller action can be inserted/returned in PHP? I thought maybe I can use it as a controller, import it, and then run that action manually? But I think that’s not the best approach.

I need it because I am making a system which has an interface with a couple of draggable and resizable ‘widgets’ or ‘windows’. It must be possible to dynammicaly load the content of each widget by using ajax or url request, and thereby it must be possible to load the content of each widget so it can be displayed when the interface is loaded for the first time.

Thanks

Look at creating an extension. If you do it properly, you will then be able to call your extension in your controllers and views.




<?php MyExt::myHelperMethod($arg1,$arg2,$arg3); ?>



http://www.yiiframework.com/doc/guide/1.1/en/extension.overview

Hey thanks for your reply,

I will take a look on the extensions, but I thought that extention are in use for other third-party developers?

I maybe thought it would be possible to import the specified controller, and then call the method loadContent() or something like that like myController::loadContent(). And then in the actionIndex printing myController::loadContent(). Is that also a good way of programming in this case? Because now the content can be loaded in php and also can be loaded on http request…?

Thanks

If you need some "black box" to be resused, create widgets.

Extension are widget that you will reuse in different application, once you have a widget, you can transfor it in an extension by moving in a different directory.

If your black box is an action, you can create an actionClass.