标签:条件 orm 方法 NPU style 网页 body new lis
public function xianshi(){ $db = D("doc"); $tj = " 1=1 "; $title = ""; if(!empty($_GET["name"])){ $title = $_GET["name"]; $tj = " title like ‘%{$title}%‘"; } $arr = $db ->where($tj) ->page($_GET["p"],5) ->select(); $zts = $db ->where($tj) ->count(); $page = new Page($zts,5); $page->setConfig("prev","上一页"); $page->setConfig("next","下一页"); $pagelist = $page->show(); // dump($pagelist); $this->assign("pagelist",$pagelist); $this->assign("name",$title); $this->assign("arr",$arr); $this->show();
<body> <div id="quanbu" style="background-image:url(__PUBLIC__/Upload/cpbj.jpg)"> <div id="head"> <h1>交流</h1> <form action="__ACTION__" method="get"> <input type="text" name="name" value="{$name}" /> <input type="submit" value="查询" /> </form> </div> <div id="left" class="cl"></div> <div id="right" class="cl"> <div id="rt"> <foreach name="arr" item="v"> <div class="title bt"><a href="content/id/{$v.id}">{$v.id} {$v.title}</a></div> <div class="btn bt">{$v.create_time|date="Y-m-d H:i:s",###}{$v.user_id} </div> </foreach> </div> <div>{$pagelist}</div> </div> </div> </body>
TP框架里网页xianshi对应CONTROLLER里的显示方法。
标签:条件 orm 方法 NPU style 网页 body new lis
原文地址:https://www.cnblogs.com/forqiwen/p/8776233.html