Create a gist now

Instantly share code, notes, and snippets.

// your controller code
public function actionIndex()
$path = dirname(__FILE__);
$data = file($path."/../data/data.txt"); // you can move all this stuff into a model or use a method
$dataProvider=new CArrayDataProvider($data, array(
// print_r($dataProvider->getData()); // will return a list of arrays.
$this->render('index', array(
'dataProvider' => $dataProvider,
// your view with CListView
$this->widget('zii.widgets.CListView', array(
'itemView'=>'_view', // refers to the partial view named '_post'
// here is your _view partial
<div id="view">
<?php echo $data;?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment