Reputation: 1800
Im trying to generate RSS page with CListView but i got additional generated html in my results:
<div id="yw0" class="list-view">
<div class="items">
and
<div class="keys" style="display:none" title="/index.php/rss"><span>2383</span><span>4743</span><span>1421</span></div>
How can i remove it?
Upvotes: 2
Views: 5625
Reputation: 17566
There's a very good wiki tutorial on Yii site about generating Feeds. CListView is intended to display an html list of items, not feed of any kind.
Upvotes: 0
Reputation: 121
actually it is quite simple, only a few lines of code.
INSTEAD of using CListView, just use its guts:
$data = $dataProvider->getData();
foreach($data as $i => $item)
Yii::app()->controller->renderPartial('your_item_view',
array('index' => $i, 'data' => $item, 'widget' => $this));
that's it.
Upvotes: 12
Reputation: 1289
You can't do it without changing CListView class (yii v.1.1.8).
CListView extends CBaseListView http://code.google.com/p/yii/source/browse/tags/1.1.8/framework/zii/widgets/CBaseListView.php
/**
* Renders the view.
* This is the main entry of the whole view rendering.
* Child classes should mainly override {@link renderContent} method.
*/
public function run()
{
$this->registerClientScript();
echo CHtml::openTag($this->tagName,$this->htmlOptions)."\n";
$this->renderContent();
$this->renderKeys();
echo CHtml::closeTag($this->tagName);
}
/**
* Renders the key values of the data in a hidden tag.
*/
public function renderKeys()
{
echo CHtml::openTag('div',array(
'class'=>'keys',
'style'=>'display:none',
'title'=>Yii::app()->getRequest()->getUrl(),
));
foreach($this->dataProvider->getKeys() as $key)
echo "<span>".CHtml::encode($key)."</span>";
echo "</div>\n";
}
Upvotes: 1