Widgets and subdictionaries


I created widget called InfoBox inside “backend” folder in “components” folder. Then I run the wighet from my layout page like this: <?php $this->widget(‘backend/InfoBox’); ?>, but I’m getting “Cannot redeclare class InfoBox” error.

How can I organize widgets in components folder to devide them to backend and front end ones?

It doesn’t matter where you place or how you organize your code. Just don’t include the file twice.

If you declared the component in your config, you do not need to include the class file in your layout or views.