


How to sort the list of DedeCMS DreamWeaver background templates alphabetically
How to sort the DedeCMS DreamWeaver backend template list alphabetically?
We know that the default sorting of the background files of the Dedecms system is very messy, not by name or by time. If there is a lot of directory content, it will be difficult to find the files you want. It is really It is too inconvenient, just like the arrangement in the picture below, there is no pattern.
So I wanted to sort these file lists by name. I looked at the files in the background. It turned out to be caused by the php function dir. Take the "Default Template Management" file list as an example and find the template in the background. File: /your backend directory/templets/templets_default.htm (dede is your backend directory), open this file and find:
<?php $dh = dir($templetdird); while($filename=$dh->read()) { if(!preg_match("#.htm#", $filename)) continue; $filetime = filemtime($templetdird.'/'.$filename); $filetime = MyDate("Y-m-d H:i",$filetime); $fileinfo = (isset($fileinfos[$filename]) ? $fileinfos[$filename] : '未知模板'); ?>
replaced by
<?php $files = scandir($templetdird); foreach ($files as $filename) { if(!preg_match("#.htm#", $filename)) continue; $filetime = filemtime($templetdird.'/'.$filename); $filetime = MyDate("Y-m-d H:i",$filetime); $fileinfo = (isset($fileinfos[$filename]) ? $fileinfos[$filename] : '未知模板'); ?>
You can see that PHP is used Caused by the dir function, the files read by dir() are out of order. Now we have to find a way to sort them by name. Here we can change another function scandir() that reads directory files; the files of this function will be sorted by name. File name sorting.
The above is the detailed content of How to sort the list of DedeCMS DreamWeaver background templates alphabetically. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Dreamweaver CS6
Visual web development tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

WebStorm Mac version
Useful JavaScript development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
