XF 2.2 How to save an order?

Robert9

Well-known member
I want to sort some posts how I want.
The posts have the post-ids

12, 19, 254, 378, 485, 698 and order like 1, 2, 3, 4, 5, 6

Now I can add a new table and save:

user_id 1, thread_id 212, personal_sort_code: 2,1,4,3,6,5

then I
build a new page, where people can fetch the posts in this order (while the page fetches the sort-order from order-table, thread-table, post-table ...)

------------------------------------

How can I generate something like a short code for the people?

Generate all permutations like

1,2,3,4,5,6 = code 001
2,1,3,4,5,6 = code 002
...

then save these mutations to a table together with the codes?
then users can drag and drop and get their personal code from this sorting?

entering the code into a form will check the sort from the table and sort the posts for viewing.

--------------

Is there a better way to produce such a short-codes?
Maybe I should not add all codes into a table;
I do this instant?

The user does a new sort;
I check if the sort exists; if not add this sort, add a new shortcode; show the shortcode to the user.

SoI only save what I really need.

I will have probably 30 posts to sort; this makes

Code:
n! / (n−k)! permutations

Really a lot.
 
Top