12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <!--分页开始-->
- <div class="page">
- <?php
- //需要变量
- $request = request();
- $url = $request->url();
-
- if (strpos($url, '-') !== false) {
- $url = explode('-', $url);
- $url = $url[0];
- } else {
-
- }
-
-
- $total = count($matches[0]);
- $pagesize = 1;
- $total_page = ceil($total / $pagesize);
- $curpage = $pa;
- $total_page_for = $total_page + 1;
- $pro_page = $pa - 1;
- $pev_page = $pa + 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) {
- 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 }
- } 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>
- <!--分页结束--->
|