多个HTML页面和分页[关闭](Multiple HTML pages & Pagination [closed])
好的,所以目前我正在为我的小型网上商店从零开始创建一个网站,并且当我的产品页面出现时,我仍然陷入困境。 目前,我有1页显示我的所有50个产品。 我计划扩展我的产品,不希望有人滚动整个页面。 我想添加多个页面,您可以点击,我相信我可以通过分页来实现这一目标。 现在,这是我感到困惑的部分:说我每页只需要显示25个产品,我在第一页上添加了一个新项目 - 如何将项目“碰到”页面2,3等等? 我认为有一些功能可以实现这一点,但我能想到的唯一方法是将产品从一个页面手动移动到另一个页面上的蛮力方式。 有什么建议么??
目前,我的网站是用所有HTML / CSS编码的,我目前刚学会了如何使用PHP批量编辑网站的某些区域 - 我正处于学习阶段! 任何建议都会有帮助。 谢谢!
Okay, so currently I'm creating a website from scratch for my small online shop and am stuck on where to even begin when it comes to my Products page. Currently, I have 1 page that displays all 50 of my products. I plan on expanding my products and do not want someone to be scrolling down the whole page. I would like to add multiple pages that you can click through and I believe I can accomplish this through Pagination. Now, this is the part where I get confused : say I only want 25 products to be displayed per page and I add a new item to the first page - how do items get 'bumped' to the page 2, 3 etc.? I would imagine there is some function to accomplish this, but the only way I can think of is doing this the brute force way of manually moving a product out of one page and onto another. Any suggestions??
Currently, my website is coded in all HTML / CSS and I currently just learned how to use PHP to mass edit certain areas of the website -- I am in the learning stages! Any suggestions would help. Thanks!
原文:https://stackoverflow.com/questions/31254129
最满意答案
试试这个(它帮助我在Mac OS X上):
casperjs --debug=yes --ignore-ssl-errors=true --ssl-protocol=any XYZ.j
XYZ.js是你的文件。
All I needed to do was to have set "sslProtocol": "any" in the config.json file that I used. A proper way to set it can be found in my answer to this question.
相关问答
更多-
TCP/IP模型是一个________。[2023-10-02]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
保存使用casperjs报废网页时获取的表格数据[关闭](Saving table data obtained while scraping a webpage using casperjs [closed])[2022-02-14]
为了简单起见,将CasperJS视为获取数据并在使用另一种语言后处理数据的方式。 我会选择#1选项 - 以JSON格式获取数据,并将其保存到文件中以便稍后执行。 为此,您可以使用PhantomJS提供的文件系统API 。 你也可以将它与CasperJS的cli接口结合起来 ,让你将参数传递给脚本(例如写入的临时文件)。 处理所有这些的脚本看起来像: 获取临时文件路径(Linux系统上的mktemp )。 调用您的CasperJS脚本,将该临时文件路径作为参数传递。 获取您的数据,使用File System ... -
关于CasperJS和代码中的错误存在一些误解: 它是__utils__而不是_utils_ 。 __utils__仅在页面上下文中可用 。 可以通过casper.evaluate访问页面上下文 。 像DOM节点这样的非原始对象不能传递出页面上下文 。 (和参考 ) 如果您对href感兴趣,那么您必须从DOM元素中读取href属性。 casper.start是异步的,但是fs.write不是,所以你必须将fs.write调用放在另一个在casper.start之后执行的异步函数中。 JavaScript对象 ...
-
试试这个(它帮助我在Mac OS X上): casperjs --debug=yes --ignore-ssl-errors=true --ssl-protocol=any XYZ.j XYZ.js是你的文件。 All I needed to do was to have set "sslProtocol": "any" in the config.json file that I used. A proper way to set it can be found in my answer to this ...
-
当前网址为http://www.twse.com.tw/en/trading/exchange/STOCK_DAY/STOCK_DAY.php ,表示您在起始页面中被阻止并等待重定向,请更改您的 casper.then(function() { this.capture(filename); this.echo("Saved screenshot of " + (this.getCurrentUrl()) + " to " + filename); }); 至: casp ...
-
只是一个注释,如果有人登陆这个问题 - 我在package.json和node-modules目录中有一个本地安装的npm'网页'模块我得到了同样的错误。 清除这些允许casperjs找到全局安装的幻像网页模块并为我修复此问题。 The problem turned out to be that I had a Phantom script called webpage.js in the directory from which I was trying to execute my Casper scri ...
-
最后编写了以下脚本。 希望它对某些人有用。 EXIT_STATUS=0 SOURCE="${BASH_SOURCE[0]}" DIR="$( dirname "$SOURCE" )" echo 'killing processes using port 9999' PORT_NUMBER=9999 lsof -i tcp:${PORT_NUMBER} | awk 'NR!=1 {print $2}' | xargs kill echo 'starting server on 9999' grunt c ...
-
在此之前我没有对此进行过regonized,但是你也得到了失败(第一个)相等的错误消息。 最后的PASS只是说casperjs已经完成了测试套件 ,无论套件内部出现什么故障。 这是完整的日志: root@4332425a143d:/casperjs# casperjs test test.js Test file: test.js # assertEquals() tests FAIL Subject equals the expected value # ty ...
-
你在这里混淆了很多东西: __utils__是clientutils模块,仅在页面上下文中可用(在casper.evaluate()内部)。 页面上下文是沙箱,因此您不能使用外部变量或将DOM节点传递到外部。 CasperJS按步骤组织,但并非所有功能都是步进功能。 casper.click()是一个阻塞点击调用,但casper.back()是异步的。 casper.click()单击与选择器匹配的第一个元素,但由于每次迭代的选择器始终相同,因此每次都会单击相同的元素。 您必须跟踪已单击的元素。 这可以在页 ...