<!--自定义分页开始-->
{eyou:sql sql="select count(*) AS num from ey_archives where $where" cachetime='3600' empty='没有数据' id="res333"}
{eyou:assign name='total_all' value='$res333.num' /}
{/eyou:sql}
<div class="page">
    <?php
        //需要变量
        $request = request();
        $url = $request->url();

        if (strpos($url, '-') !== false) {
            $url = explode('-',$url);
            $url = $url[0];
        }else{

        }

        $total = $total_all;
        $pagesize = 12;
        $total_page = ceil($total/$pagesize);
        //$curpage = $curpage;
        $total_page_for = $total_page + 1;
        $pro_page = $curpage - 1;
        $pev_page = $curpage + 1;
    ?>
    <div class="page-a">
    {eyou:if condition='((int)$total_page > 1)'}
        {eyou:if condition='((int)$curpage === 1)'}
            <li><a>首页</a></li>
            <li><a>上一页</a></li>
        {eyou:else /}
            <li><a href="{$url}">首页</a></li>
            {eyou:if condition='((int)$curpage === 2)'}
                <li><a href="{$url}">上一页</a></li>
            {eyou:else /}
                <li><a href="{$url}-{$pro_page}">上一页</a></li>
            {/eyou:if}
        {/eyou:if}

        {eyou:for start='1' end="$total_page_for"}
            {eyou:if condition='((int)$i === 1)'}
                {eyou:if condition='((int)$curpage === $i)'}
                    <li class="active-1"><a>{$i}</a></li>
                {eyou:else /}
                    <li><a href="{$url}" data-ey_fc35fdc="html" data-tmp="1">{$i}</a></li>
                {/eyou:if}
            {eyou:else /}
                {eyou:if condition='((int)$curpage === $i)'}
                    <li class="active-1"><a>{$i}</a></li>
                {eyou:else /}
                    <?php if($total_page > 10){ ?>

                        <?php if(((int)$curpage-2)<$i && ((int)$curpage+2)>$i || ((int)$total_page-1)<$i && ((int)$total_page+1)>$i || 0<$i && 2>$i){  ?>

                            <li><a href="{$url}-{$i}" data-ey_fc35fdc="html" data-tmp="1">{$i}</a></li>

                        <?php }else{ ?>

                            <?php if(((int)$curpage) > 3 && ((int)$curpage-2) === $i){ ?>
                                <li>...</li>
                            <?php } ?>

                            <?php  if(((int)$curpage+2) < $total_page && ((int)$curpage+2) === $i){ ?>
                                <li>...</li>
                            <?php } ?>

                        <?php } ?>

                    <?php }else{ ?>
                        <li><a href="{$url}-{$i}" data-ey_fc35fdc="html" data-tmp="1">{$i}</a></li>
                    <?php } ?>
                {/eyou:if}
            {/eyou:if}
        {/eyou:for}
        {eyou:if condition='((int)$curpage === (int)$total_page)'}
            <li><a>下一页</a></li>
            <li><a>末页</a></li>
        {eyou:else /}
            <li><a href="{$url}-{$pev_page}" data-ey_fc35fdc="html" data-tmp="1">下一页</a></li>
            <li><a href="{$url}-{$total_page}" data-ey_fc35fdc="html" data-tmp="1">末页</a></li>
        {/eyou:if}
    {/eyou:if}
</div>
    <div class="page-b">
    共<strong>
    {eyou:php}
        echo $total_page;
{/eyou:php}
    </strong>页 <strong>{$total}</strong>条
    </div>
</div>

<!--自定义分页结束-->