显示结果超链接号,例如搜索引擎 [英] Displaying results hyperlink numbers like a search engine

查看:102
本文介绍了显示结果超链接号,例如搜索引擎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何在搜索结果页面的底部创建超链接号吗,就像搜索引擎加载下一批结果一样?

Does anyone know of a good resource on how to create the hyperlink numbers at the bottom of a results page as search engines do to load the next number of results?

页面将加载前10个结果.然后,如果您单击该数字,它将在该10个数字范围内加载相应的结果.

The page would load the first 10 results. And then if you click on the number, it loads corresponding results in that 10 number range.

示例:

0-10->不显示数字

0-10 -> show no numbers

11-20->显示1、2

11-20 -> show 1, 2

21-30-> 1,2,3

21-30 -> 1, 2, 3

最多50 1,2,3,4,5 ..... 67 [最后一个数字]大于50的情况.

up to 50 anything more than 50 does 1,2,3,4,5.....67 [last number].

到目前为止,我的想法(我在PHP/mysqli中这样做,但是逻辑比代码更重要):

My thoughts so far (I'm doing this in PHP/mysqli but the logic is more important than the code):

$total = mysqli_num_rows($result) //total number of reqults from sql query
if ($total>10) {
$last = intval($total/10) + 1 //get the last number of the results

if($last <= 5){
for ($i, $i<$last, $i++){
//print the numbers as hyperlinks
} else {
  //print 1 through 5 ... then $last
}
}

尽管这仅是1-5 ...最后一个数字是静态的,而搜索引擎拥有它,所以如果您单击该数字,它会记住该数字并以此为新逻辑.因此,如果我在公式中单击5,它应该变为:

This though is static from only 1-5...last number while the search engines have it so if you click on the number, it remembers that number and bases the new logic on it. So if I click on the 5 in my formula, it should change to something like:

[上一个] 3,4,5,6,7 .... 67 [下一个]

[previous] 3,4,5,6,7....67 [next]

然后我将数字再次传递给页面本身,并根据传递的数字来限制结果.还有关于传递信息的最佳方式的建议吗?

And then I would just pass the number to the page itself again and limit the results based on what number was passed. Any suggestions also on the best way to pass the info?

推荐答案

您正在寻找一个分页脚本.访问此链接该页面为阿拉伯语,而第四篇为分页,您可以下载英语或分页的阿拉伯语版本

You are looking for a pagination script. Visit this link The page is in Arabic but forth post is of pagination and you can download source for english or arabic version of pagination

这篇关于显示结果超链接号,例如搜索引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆