PHP |当前页面 URI 切换器 | “分页”
我正在尝试为同一产品的不同型号制作快速页面切换器。如果必须单独完成,这将很难实现,因此我使用一些 PHP 来实现。
每个产品的所有模型都有一个文件夹,问题是对它们进行正确排序,每个页面都已创建。每个型号在产品文件夹内都有自己的文件夹,并以数字结尾。
它们都属于两种类型的 URI
../product-name/###
或 ../product-name/title-###
所以我正在尝试编写一个 PHP 脚本,该脚本将采用当前页面的 URI 的 ###
、下一个最低/最高的 ###
,并将它们设置为 href 对于任一箭头。
如果没有下一个最低/最高的###
,则将箭头透明度设置为0(如果需要,可以使用class
来完成。
当前页面
code> 将填充当前页面的
有人至少能指出我正确的方向吗?非常感谢任何和所有帮助!
更新:感谢@gumbo,我现在知道这称为分页,如果有人知道至少与此非常相似的预构建脚本,请告诉我,谢谢!!
PS:我最终会将所有内容转移到 WordPress,所以如果这会让事情变得更容易,那么我就会等待。
I'm attempting to make a quick page switcher for different models of the same product. This would be hard to implement if it had to be done individually, so I'm making it with some PHP.
There is a single folder with all the Models for each product, the problem is correctly sorting them, the pages are already created with each one. Each model has its own folder inside of the product folder and ends with a number.
They all fall within two types of URI's
../product-name/###
or ../product-name/title-###
So I'm trying to write a PHP script that would take the current page's URI's ###
, the next lowest/highest ###
, and set them as the href
for either arrow.
If there is no next lowest/highest ###
then set the arrow transparency to 0 (can be done with a class
if necessary.
The Current Page
would fill with the current page's <title>
Can someone at least point me in the right direction? Any and all help is greatly appreciated!
UPDATE: Thanks to @gumbo I now know that this is called pagination, if anyone knows of a Pre-built script that works at least very similar to this please let me know, THANKS!!
PS: I'm eventually moving everything over to wordpress, so if that would make it much easier then I'll just wait.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我理解正确的话,您希望访问目录的内容并对文件进行排序。
这应该给你一个开始。使用基本名称($_SERVER['SCRIPT_NAME']);检索当前脚本的名称。也许下一步是提取当前脚本的 ### 并用针对每个文件的测试替换上面示例中的 span 元素。
If I understand correctly, you'd like to access the contents of a directory and sort through the files.
That should give you a start. Use basename($_SERVER['SCRIPT_NAME']); to retrieve the name of the current script. Perhaps the next step would be to extract that current script's ### and replace the span element in the above example with a test against each file.