The realization scheme of the top of the article

problem description: a blog system is being developed that needs to achieve the top of an article, and then the foreground will display the article (or more than one) at the top. What I want is to add a new field to determine whether it is a top article, but how does the front desk show it? Do you judge when you cycle the article?

related code: open source address: https://github.com/ruibaby/halo

Mar.07,2021

change the array, delete the current data first, add it to the array header, and try to re-splice the fields
slidImgArr.splice ($(this) .attr ("data-id"), 1);
slidImgArr.unshift ($(this) .attr ("data-img"));)


if you are the backend, when you return to the front end, you put the top in the first place in the array, and then return it to the front end. The front end tries not to do these processing as far as possible, because the back end processing will be convenient for many


back-end processing to you, and you will show it in turn.


this requirement can be handled by both front and back ends. It must be that the back end wants the front end to handle it, and the front end wants the back end to handle it.
I personally think that from the perspective of the overall performance of the website, some operations such as simple computing (data formatting) and sorting are best done at the front end:
1. The back-end server is limited and the processing capacity is limited. Handing part of the computing work to the front-end (end-user's computer) can reduce the pressure on the back-end server and improve the overall performance.
2, PC configuration is getting higher and higher, do a little more basic calculation, for users, basically no feeling, no impact;
3, front-end jquery not only supports append, but also supports insert, so just go through it;


if all articles are sent to the front end at once, front-end processing is fine
but if not all articles are sent to the front-end, the front-end cannot be processed. There can only be a backend to do
articles. How many articles are there? It's no problem now, but will pagination be involved in the future?
if it is a top, it is possible that the latter top is more important than the previous top, so it is recommended to write number
each time the top is + 1 under the current category. If there is no top, the default is 0. The back end can be sorted by the size of the top field

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e7b2c1-836.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e7b2c1-836.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?