Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View gist:eee790c9d06e0e9c6360
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
// your controller code
<?php
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(
'pagination'=>array(
'pageSize'=>10,
),
));
// print_r($dataProvider->getData()); // will return a list of arrays.
$this->render('index', array(
'dataProvider' => $dataProvider,
));
}
?>
 
// your view with CListView
<?php
$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>'_view', // refers to the partial view named '_post'
));
?>
 
 
// here is your _view partial
 
<div id="view">
<?php echo $data;?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.