如何为我的自定义博客文章创建档案?
我有自己的 CMS 来存放我的博客文章。我使用的数据库由五列组成,名称为 1:id(主键)、标题、正文、日期、作者。 我想做的是为我的博客创建档案,告诉我如何使用 php 和 mysql 创建它?
我关心的是创建一个像 WordPress 网站页面上那样的存档,我的意思是我可以按日期、月份和年份汇总帖子,这将计算特定日期的帖子数量。当任何用户通过进入“档案”部分点击该日期时,必须向他显示当天发布的所有帖子。
I am having my own CMS for my blog-posts. I am using a database which consists of five columns named, 1: id(primary key), title, body, date, author.
What I want to do is to create ARCHIVES for my blog, tell me how to create it using php and mysql?
I am concerned to create a archive like it is used to be on wordpress website pages, I mean i can summaries the posts by date, month and year, which will count the number of posts on particular date. When any user clicks on that date by going in the Archives section, he must be shown all the posts made on that day.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您要求的档案只是对数据库的查询,以查找特定日期范围内的帖子。例如,特定日、周、月或年的所有帖子。例如:
在 SQL 中要找出特定日期是否
MONTH(date)
值年份(日期)
value您可以在 SQL 中比较更多的日期/时间值,这应该足以让您自己使用它。
The archives you're asking for are just queries to your database to find posts in a specific date range. For example all posts of a specific day, week, month or year. E.g.:
In SQL to find out if a specific date
MONTH(date)
valueYEAR(date)
valueThere is much more you can compare date/time values in SQL, this should give you enough to play around with it on your own.