Dragonfly CMS v9 ⇒ Modules & Blocks :: Archives ⇒ How can I change Preview Theme block to ASC list? :: Archived ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum IndexModules & Blocks

Archived ⇒ How can I change Preview Theme block to ASC list?


I absolutely don't understand how the Preview Theme block is organized. They're listed in a jumbled mess. The code in 9.1.2 pulls from a readdir instead of sql. So how can I list them alphabetically from a reddir? I've tried looking at php.net for the answer but couldn't find it.

Can the developers please list them alphabetically in the next update or at least comment code to allow us to do it ourselves. I had no problem doing it for 9.0 block. 9.1.2 is done in a completely different way.

This is a long standing issue that theme designers have with the preview theme block actually and one that I've love to see fixed in a future update.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux/1.3.33/4.4/4.3.11


block for 9.0.6.1 used the same method....
it's hard for me to test because my server shows them sorted for some reason (Windows server?)
the block uses natcasesort() to sort the list (but this maintains the index)
try adding at line 42 (rights after the natcasesort line)

$themelist=array_values($themelist);

Admin - Great Lakes Web Designs
Theme Designer - WebSite Guru Designs
Site Admin - Families with Food Allergies

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux 2.6.27-grsec/Apache 2.2.11/MySQL 5.0.67-community-log/PHP 5.2.8/DF 9.2.1


Oh I was remembering something completely different. I was sure it was this block but apparently not. Went back into my old blocks and old versions of the original. Definitely never sorted by sql. My fault.

I got it working now using the same method as last time. Just changed natcasesort to sort. Simple enough.

Preview Theme Replacement Block (alphabetical) for 9.1 is available from my site now.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux/1.3.33/4.4/4.3.11


Using sort is not, and never was, the correct solution.

I suggest you adopt the correct solution provided by rlgura.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):

All times are UTC