Answer the question
In order to leave comments, you need to log in
How to change the order of categories in the database in DLE?
In DLE, categories are written to the database in ID order.
That is, each category has an ID, and no matter how you add them, the database will have the order 1,2,3,4,5...
And I want to keep the order that I set when creating the news.
I have several categories, but the first is the main one, and the rest are secondary.
So I can have something like this - category: 5,2,1,4
An example of this on the Toaster when choosing the main category for a question.
There is a file responsible for adding $category_list, but I don't understand where everything is formed.
Answer the question
In order to leave comments, you need to log in
You shouldn't do that.
How data is stored in a database is up to the database.
The order can even change, with some commands changing the database, for example, optimize table X
It's more correct to add an additional column, for example order, for the main one you set the order 1, for the rest 2,3,4,5
and sort when outputting.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question