Page 1 of 1

Sorting Results of {cge_file_list}

Posted: Thu Jul 12, 2018 10:16 pm
by montedavis
Hello I used {cge_file_list} to pull a list of images from my site. The image list comes back fine but I'm not sure how to sort order the list by alpha?


CMS Made Simple Install Information
CMSMS Version 2.2.5

Installed Modules
AdminSearch 1.0.4
CGExtensions 1.57.1
CGSimpleSmarty 2.1.7
CMSContentManager 1.1.6
CMSMailer 6.2.14
Captcha 0.5.5
CmsJobManager 0.1.2
DesignManager 1.1.4
FileManager 1.6.5
FilePicker 1.0.2
FormBuilder 0.8.1.6
Gallery 2.3.2
JQueryTools 1.4.0.3
MenuManager 1.50.3
MicroTiny 2.2.2
ModuleManager 2.1.3
Navigator 1.0.8
News 2.51.3
Products 2.28.3
Search 1.51.2
TinyMCE 3.2-beta3

Re: Sorting Results of {cge_file_list}

Posted: Thu Jul 12, 2018 10:21 pm
by Rolf

Re: Sorting Results of {cge_file_list}

Posted: Thu Jul 12, 2018 11:11 pm
by calguy1000
try something like:

Code: Select all

{cge_file_list dir='foo/bar' assign='tmp'}
{@ksort($tmp)}{* no output from this *}
<select name="...">
    {html_options options=$tmp selected=$something}
</select>
havent' tried it, but it should work.

SOLVED Re: Sorting Results of {cge_file_list}

Posted: Fri Jul 13, 2018 2:32 pm
by montedavis
I added: {@ksort($filelist)} but this threw and error about the "@" symbol. I removed the "@" symbol and used the following which worked.

{cge_file_list dir='foo' pattern='*.jpg' maxdepth='1' assign='filelist'}{$sortedlist = ksort($filelist)}
{foreach $filelist as $sortedlist}
{$sortedlist}
{/foreach}


Thank you for your help!