PHP 用户设置显示顺序
我正在尝试构建一个 CMS,并且想知道如何拥有它以便后端的用户可以动态设置页面显示顺序。我知道MySQL如何进行ORDER BY,但我希望用户能够说这个页面应该是第一个,等等。我什至不知道如何解决这个问题,所以任何帮助将不胜感激!谢谢!
I am trying to build a CMS and was wondering how I can have it so the user on the backend can dynamically set the pages display order. I know with MySQL how to the ORDER BY but I want the user to able to say this page should be first, etc. I am not even sure how to approach this so any help would be greatly appreciated! Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需将“order”INT 字段添加到您的“pages”表或您存储这些数据的位置即可。然后,只需为用户提供以某种方式进行编辑的选项,例如拖放页面,然后在设置导航时,只需按顺序字段进行排序即可。
Just add an 'order' INT field to your 'pages' table, or where ever you are storing the data for those. Then just give the user the option of editing that somehow, such as drag n' dropping the page, then, when setting up the navigation, just order by the order field.