Php Yii和引导分页访问
我不知道如何用我的代码进行分页。我会把每页三个项目,但我不知道怎么做。如果有人能指引我Php Yii和引导分页访问,php,twitter-bootstrap,yii,pagination,Php,Twitter Bootstrap,Yii,Pagination,我不知道如何用我的代码进行分页。我会把每页三个项目,但我不知道怎么做。如果有人能指引我 <?php $rows = Yii::app()->db->createCommand() ->select('username,hash') ->from('cruge_user') ->queryAll(); echo "<table class='table table-striped' id='connect_table' border=1 style=
<?php
$rows = Yii::app()->db->createCommand()
->select('username,hash')
->from('cruge_user')
->queryAll();
echo "<table class='table table-striped' id='connect_table' border=1 style='width:300px'>
<tr>
<td>USUARI</td>
<td>ESTAT</td>
</tr><tr>";
foreach ($rows as $key => $valor) {
foreach ($valor as $col => $valors) {
if($col=='username'){
$username=$valors;
if($username!=$user){
echo "<td><i class='icon-user'>__".$valors."</td>";
}
}
// $( document ).ready(function() {
if($col=='hash'){
if($valors!=""){
if($username!=$user){
//echo "<td><button id='connect' value='\"$valors\"' type='button'>PLAY</button></td>";
echo "<td class='success'><button title='clica per jugar' class='btn' id='connect' onclick='envia_hash(\"$valors\")' type='button'></button></td>";
echo "</tr>";
}
}else {
echo "<td><img title='desconectat' src='../img/disable.png'></td>";
echo "</tr>";
}
}
}
}
我认为解决这个问题最简单的方法是使用CGridView小部件。它有过滤器,分页和您的代码将更干净
看一看
编辑:您可以使用引导类,也可以使用基于引导的小部件使用cgridview。它自动分页。