Dynamic Sidebar using CClipWidget

Comparing #1 with #2

Revision #2 was created by Cozumel Cozumel on Dec 7, 2013, 8:36:48 AM.

closed the divs, for all the copy/paste monkeys out there

Content

[...]
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!