Download the official example package and find the example page below.
2. Locate Page.class.php and copy to your own project Thinkphp/lib/think/util below.
3.
PHP code
Public Function dopage () {
echo $_get["P"];
if (Emptyempty ($_get["P"]))
$this->assign (' P ', 1);
Else
$this->assign (' P ', $_get["P"]);
$Nav = M ("navigation");
$count = $Nav->count ();
Import ("ORG. Util.page ");
$p = new Page ($count, 10);
$page = $p->show ();
$list = $Nav->order (' Id ASC ')->limit ($p->firstrow. ', '. $p->listrows)->select ();
$this->assign (' page ', $page);
$this->assign ("list", $list);
}
4.
PHP code
<div>{$page}</div>
<table width= "100%" border= "0" cellpadding= "0" cellspacing= "0" >
<tr>
<th>ID</th>
<th> Description </th>
<th> Paths </th>
<th> Notes </th>
<th> level </th>
<th> Parent Navigation id</th>
<th> Edit </th>
<th> Delete </th>
</tr>
<present name= "List" >
<volist name= "list" id= "Vo" mod= "2" >
<eq name= "mod" value= "0" >
<tr class= ' TR1 ' >
<td>{$vo. Id}</td>
<td>{$vo .description}</td>
<td>{$vo .addr}</td>
<td>{$vo .remarks}</td>
<td>{$vo .level}</td>
<td>{$vo .parsentid}</td>
<td><a href= "__url__/getnavigationbyid/id/{$vo. id}/p/{$p} ">Edit</a></td>
<td><a href= "__url__/delnavigationbyid/id/{$vo. id}/p/{$p} ">Delete</a></td>
</tr>
</eq>
<eq name= "mod" value= "1" >
<tr class= ' TR2 ' >
<td>{$vo. Id}</td>
<td>{$vo .description}</td>
<td>{$vo .addr}</td>
<td>{$vo .remarks}</td>
<td>{$vo .level}</td>
<td>{$vo .parsentid}</td>
<td><a href= "__url__/getnavigationbyid/id/{$vo. id}/p/{$p} ">Edit</a></td>
<td><a href= "__url__/delnavigationbyid/id/{$vo. id}/p/{$p} ">Delete</a></td>
</tr>
</eq>
</volist>
</present >
</table>
<div>{$page}</div>
thinkphp Sub-page