findSql分页

//控制器产品列表
    function paimailist() {
        $key = urldecode($this->spArgs("key"));
        $leibei = $this->spArgs("leibei");
        $tj = $this->spArgs("tj");
        $cj = $this->spArgs("cj");

        $condition = "SELECT * FROM paimai WHERE 1=1";
        if($leibei !=0) {
        $condition .= " and leibei = '$leibei'";
        }

        if($tj != 0) {
        $condition .= " and tj = '$tj'";
        }

        if($cj != 0) {
        $condition .= " and cj = '$cj'";
        }

        if($key !=""){
             $condition .= " and title like '%$key%'";
        }
        $paimaiobj = spClass("lib_paimai");
        $this->results = $paimaiobj->spPager($this->spArgs('page', 1), 10)->findSql($condition, 'id DESC');
        $this->pager = $paimaiobj->spPager()->getPager();
        $this->key = $this->spArgs("key") ;
        $this->leibei = $this->spArgs("leibei") ;
        $this->cj = $this->spArgs("cj") ;
        $this->tj = $this->spArgs("tj") ;
        $this->display("admin/paimai_list.html");
    }

模板里面表单

藏品名称 只查看推荐 只查看已售

模板分页代码

<{if $pager}>

                                共有文章<{$pager.total_count}>条,共有<{$pager.total_page}>页(每页<{$pager.page_size}>篇文章):

                                

                                <{if $pager.current_page != $pager.first_page}>

                                前页 |

                                上一页 |

                                <{/if}>

                                

                                <{foreach from=$pager.all_pages item=thepage}>

                                <{if $thepage != $pager.current_page}>

                                <{$thepage}>

                                <{else}>

                                <{$thepage}>

                                <{/if}>

                                <{/foreach}>

                                

                                <{if $pager.current_page != $pager.last_page}>

                                |

                                下一页 |

                                后页

                                <{/if}>

                                <{/if}>


你可能感兴趣的:(SpeedPHP框架,input,class,action,function,c,产品)