OneThink使用

常量调用

调用网站设置的常量,即网站常量配置。
{:C('QQ')}

分页调用

后台代码块

public function test(){
        //$Model  =   D(parse_name(get_table_name(5),1));   //根据模型id获取模型
        $Model = M('Document_page');
        $page = new \Think\Page($Model->count(),1);        //直接根据表名获取
        $list = $Model->limit($page->firstRow.','.$page->listRows)
                ->select();
        //设置分页主题
        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
        $this->assign('_page',$page->show());
        $this->assign('list',$list);
        $this->display();
    }

前端调用

<ul>
    <volist name="list" id="vo">
        <li><a href="{:U('Index/detail?id='.$vo['id'])}">{$vo.title}</a></li>
    </volist>
</ul>

<div class="page">
    {$_page}
</div>

 

分页皮肤

<style>
    a{text-decoration: none;}
    .page {
        margin: 10px 0;
        *zoom: 1;
    }
    .page:before,
    .page:after {
        display: table;
        content: "";
    }
    .page:after {
        clear:both;
    }
    .page a,
    .page span {
        float: left;
        margin-left: -1px;
        padding: 0 14px;
        height: 30px;
        line-height: 30px;
        color: #000;
        border-top: 1px solid #CCCCCC;
        border-bottom: 1px solid #CCCCCC;
        /*background-color: #4bbd00;*/
    }
    .page a:hover
    {
        text-decoration: none;
        background-color: #387C0B;
    }
    .page .current {
        border-top: 1px solid #387C0B;
    }
    .page .next,
    .page .prev {
        font-family: "宋体";
        font-weight: bold;
    }
    .page .rows {
        border-right: 1px solid #CCCCCC;
    }

   /*pifu*/
    .page a,
    .page span {
        color: #000;
        border: 1px solid #ccc;
        /*background-color: #7963df;*/
    }
    .page a:hover {
        background-color: #E1E1E1;
    }
    .page .current {
        border-top: 3px solid #7963DF;
        height: 28px;
        line-height: 26px;
    }

</style>
View Code

 

 

你可能感兴趣的:(OneThink使用)