konapaz
(Konapaz)
1
Hi
How can I capture a part output of html code into a variable without ob_start and ob_get_contents etc but only using Yii Api?
for example I want like that
$this->beginContent('...',true); ?>
...html code here...
<?php $myvariable = $this->endContent(); ?>
I want the $myvariable to contains all the …html code here… without output anything of this part
I found something similar in http://www.yiiframework.com/doc/api/1.1/CController#renderPartial-detail with $processOutput=true
but I want it for a part o view not entire view
Thanks
Keith
(Kburton)
2
If you can encapsulate the code in a widget, you can capture the output of that using the third parameter. See here.
konapaz
(Konapaz)
3
Hi Keith
Did you find out which widget is appropriate for that issue?
for example
$this->beginWidget('zii.widgets.CPortlet','',true); ?>
...html content here...
<?php $this->endWidget();
the CPortlet decorates the content, but I want to get the pure content. Or better I sould to make my own widget?
Thanks for your response 
konapaz
(Konapaz)
4
I found a solution by clips
$this->beginClip('myvar'); ?>
...html content here.
<?php $this->endClip();
$myvar= $this->clips['myvar'];
If anyone find another solution please post 
Keith
(Kburton)
5
I meant to write your own widget, but clips are probably more appropriate.
konapaz
(Konapaz)
6
Ok Keith, Thanks for your advice 