Search code examples
phpmysqlcontent-management-systemdynamic-data

PHP User Set Display Order


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!


Solution

  • 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.