Disuz picture order confusion solution_php skills

WBOY
Release: 2016-05-16 20:09:47
Original
1028 people have browsed it

Description

When discuz publishes a post, it adds multiple pictures and then publishes the post directly. The order of the pictures sometimes gets messed up
Even if the order of the images in the upload image window is correct, they will still be messed up after publishing

Analysis

Look at the url, you can’t see anything in the program code
Change the picture name to serial number and upload it. The order is messed up. Note the order of the messed up pictures in the post: 76123458
Then find the bbs_forum_attachment_1 table in the database and find that the default order is also this:

I don’t even sort by aid. When I could pick it up, I just picked it up without ordering by
Find the php that directly operates this table: sourceclasstabletable_forum_attachment_n.php
Through the writelog('filename','log') method, it is found that every time the post is refreshed, fetch_all_by_id, this method is executed once
It turns out that when viewing a post, the attachment address that is not inserted into the post must be read from the database every time

Solution

Modify the default parameters passed in the fetch_all_by_id method: order_by='aid'

Refresh the post where the order of the pictures was messed up and found that the order is normal

The above is all about the modification of discuz. I hope it can be helpful to everyone.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!