Sorting Results of {cge_file_list}

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
montedavis
Forum Members
Forum Members
Posts: 64
Joined: Wed Jul 03, 2013 7:44 pm

Sorting Results of {cge_file_list}

Post 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
User avatar
Rolf
Dev Team Member
Dev Team Member
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Sorting Results of {cge_file_list}

Post by Rolf »

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Sorting Results of {cge_file_list}

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
montedavis
Forum Members
Forum Members
Posts: 64
Joined: Wed Jul 03, 2013 7:44 pm

SOLVED Re: Sorting Results of {cge_file_list}

Post 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!
Locked

Return to “Modules/Add-Ons”