search
HomeCMS TutorialDEDECMSHow to sort the list of DedeCMS DreamWeaver background templates alphabetically

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.&#39;/&#39;.$filename);
$filetime = MyDate("Y-m-d H:i",$filetime);
$fileinfo = (isset($fileinfos[$filename]) ? $fileinfos[$filename] : &#39;未知模板&#39;);
?>

replaced by

<?php
   $files = scandir($templetdird);
   foreach ($files as $filename)
   {
      if(!preg_match("#.htm#", $filename)) continue;
      $filetime = filemtime($templetdird.&#39;/&#39;.$filename);
      $filetime = MyDate("Y-m-d H:i",$filetime);
      $fileinfo = (isset($fileinfos[$filename]) ? $fileinfos[$filename] : &#39;未知模板&#39;);
   ?>

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!

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment