Hi all,
I have a layout with the following structure:
<div class="breadcrumbs">
<?php $this->widget('zii.widgets.CBreadcrumbs', array(
'links'=>$this->breadcrumbs,
'homeLink'=>CHtml::link('Main', Yii::app()->homeUrl),
)); ?>
</div>
<div class="content">
<?php
$this->widget('myblock_widget', array());
?>
</div>
Then I have my widget which looks like this:
class MyWidget extends CWidget
{
public function init()
{
// this method is called by CController::beginWidget()
}
public function run()
{
$this->renderContent();
}
protected function renderContent() {
Yii::app()->controller->breadcrumbs = CMap::mergeArray($currentBreadcrumbs, array('Test'));
}
}
So what I’m trying to achieve is to change the controller attribute from MyWidget. If I do a print_r(Yii::app()->controller->breadcrumbs) from the widget view I see the expected results, but I want this to happen also in the layout which still keep the value settled from the controller. If I place the breadcrumbs after “myblock_widget” all works perfect, but I need to have the breadcrumbs before that.
Any idea how to solve this?