Changes
Title
unchanged
Dynamic Sidebar using CClipWidget
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
sidebar, dynamic, CClipWidget, output buffering
Content
changed
[...]
Then, in each your views just use the following:
```php
<?php $this->beginWidget('system.web.widgets.CClipWidget', array('id'=>'sidebar')); ?>
<div>Some non-common output</div>
<?php $this->widget('application.components.widgets.SomeReusableWidget'); ?>
<div>Some more non-common output<
/div>
<?php $this->endWidget();?>
```[...]
```php
<?php ob_start(); ?>
<div>Some non-common output</div>
<?php $this->widget('application.components.widgets.SomeReusableWidget'); ?>
<div>Some more non-common output<
/div>
<?php $this->sidebar = ob_get_clean(); ?>
```
Whichever of these ways you choose to do it, it's better than lots of if statements in your column2.php layout file or repeating the layout in each view file!