I wrote a simple CMS for one of my clients which does specifically what he needs (without the bloat of mainstream content management systems he would never use).
The CMS enables him to create and manage two types of content: pages and news (short messages that show in the sidebar).
The pages are displayed in the navigation menu of the website sorted alphabetically. My client would like to be able to sort the pages himself in a custom order.
What is the best way to do this programatically? I’m thinking of adding a column called “priority” to the pages table. It will be a number and the pages will be sorted based on this number either ascendingly or descendingly. And the client could edit this number for every page?
Just curious what are your thoughts about this? Is there a better way to do this? Some design pattern for this purpose?
I personally use the jQuery ui sortable plugin. The client can drag and drop the items from a list, changing the order.
Next I use jQuery again to loop through the list of items, compile CSV list of id’s and send it to the server.
and on the server:
It might be more “quick ‘n dirty” than a nice Design Pattern, but it works.