Development - Widgets

Generally widget is a class that inherits from CWidget helper class. It is a helper "component" that is mainly used for presentational purposes. A widget is usually embedded in a view script to generate a complex, yet self-contained user interface. For example, CFormView widget can be used to render a complex form user interface, CMenu widget can be used to render a different menus, CDataForm allows work with models, save data, etc. Generaly widgets may be used in controllers, views or in template files.

To use a widget, you have to call it in a following way:
echo CWidget::create('CMessage', array(
    'Click <a href="login"><b>here</b></a> to log into the system as administrator.'
$output = CWidget::create('CMenu', array(
        array('label'=>($viewRightMenu) ? 'Back to Admin Panel' : 'Home', 'url'=>'authors/index'),
        array('label'=>'Logout', 'url'=>'login/logout'),
Here the full list of current system widgets: Please note, that some widgets may be used by other widgets, so you may have an composite widget that has many embedded simple widgets, like: CGridView, CFormView, etc. Also all keys in parameters are case-sensitive.

You may always check the CWidget class in core/helpers/CWidget.php to learn the syntax of each widget (included in the header comments of each widget file) or see the examples of the code.