将页面合并为一个页面 [英] merge pages into one page

查看:124
本文介绍了将页面合并为一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3页,home.php,next.php页面和other.php.in home.php页面

i从数据库中选择的名字,我给了它一个限制,也是

一个if语句来回显next.for next.php页面和other.php我做了同样的

的事情,但我指出(其中comp_id> 3限制3)下一个页面(其中comp_id> 6限制3)

其他页面,以便分别显示下一个3名称,并且旁边和后面回显

进入上一页。我怎么能把这些页面合二为一,这样当我点击下一步它将

带我到相同的页面,但显示下一个名字。

i have 3 pages,home.php, next.php page and other.php.in the home.php page
i selected name from the database and i gave it a limit and also
an if statement to echo next.for the next.php page and other.php i did the same
thing but i indicate (where comp_id >3 limit 3) for next page (where comp_id >6 limit 3)
for other page so as to display the next 3 name repectively and also echo next and back
to go the previous page.how can i put these pages into one so that when i click next it will
take me to the same pages but display the next name.

展开 | 选择 | Wrap | 行号

推荐答案

嗨。


你所谈论的(至少,我认为你在说什么)被称为分页。尝试谷歌搜索这个术语你应该得到一堆详细的教程。


但是,基本上,你做的是你在网址中放置一个页码:
Hi.

What you are talking about (or at least, what I think you are talking about) is called "pagination". Try Googling that term an you should get a bunch of detailed tutorials.

But, essentially, what you do is you place a page number into the URL:
展开 | 选择 | Wrap | 行号


我的if语句有问题我想要

NEXT(通过url传递变量)来显示第一页的第3页

图像已经完成,它不应该显示

BACK(通过url传递变量)。当NEXT显示

并点击将值传递到页面如果图像显示为

一个或两个它应该单独显示BACK a但如果是三个它应该

显示BACK和NEXT
i am having a problem with my if statement i want
NEXT(passing variable througth url) to display when the first 3
image in the first page is complete and it should not display
BACK(passing variable through url) yet. when the NEXT is display
and is click on to pass a value into page if the image display is
one or two it should display BACK a alone but if it is three it should
display BACK and NEXT
展开 | 选择 | Wrap | 行号


我真的不明白你是什么在说。你能尝试更清楚地解释吗?


只是试图显示/隐藏First / Last页面上的Back / Next按钮?


如果是这样,那么后退按钮没问题。页面ID为1或更高的任何页面都应包含该页面。页面ID为0的那个不应该。


下一步按钮比较棘手。您必须确定当前页面是否实际上是最后一页,这将要求您获取表中的总行数,将它们除以每页的行数并将其与当前页码进行比较。 (注意;数字不是ID。页码是ID + 1,请记住。)


PS

当你获取数组元素时,你应该使用字符串作为元素名称。应引用所有字符串,否则它们将被视为常量。

你的代码中的数组现在正在为你工作的唯一原因是因为PHP假设你不知道这个并且正在为你转换它们。如果您启用了调试消息,你会看到的。
I don''t really understand what you are saying. Could you try explaining a bit more clearly?

Are just trying to show/hide the Back/Next buttons on the First/Last pages?

If so, then the Back button is no problem. Any page with a page ID of 1 or higher should include it. The one with page ID 0 should not.

The Next button is trickier. You would have to find out if the current page is in fact the last page, which would require you to fetch the total amount of rows in the table, divide them by the number of rows per page and compare that with the current page number. (Note; the number not the ID. The page number is the ID + 1, remember.)

P.S.
When you fetch array elements, you should use strings as the element names. All strings should be quoted, or they will be considered constants.
The only reason why the arrays in your code are working for you right now is because PHP is assuming you don''t know this and is converting them for you. If you had debug messages enabled, you would see that.
展开 | 选择 | Wrap | 行号


这篇关于将页面合并为一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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