filesets

Permalink
Hi,
Im trying to get a list of all the files in a set, lets call the set "myset".
how would I go about this?
So far I have found concretes docs on files and sets, just cant work out how to get the set in the first place. at the moment I would just like to hard code the set into the page.

Ok I managed to get this to have no errors at least but doesn't display anything.
Loader::model('file_list');
$fl = new FileList();
$fs = FileSet::getByName("myset");
$set = $fl->filterBySet($fs);
print_r ($set)
echo $set;

tryed echo and print_r - displays nothing
http://www.concrete5.org/documentation/developers/files/searching-a...

any advice would be great thanks

mikeyt55
 
SheldonB replied on at Permalink Reply
SheldonB
goldhat replied on at Permalink Reply
The issue is you are loading the file list model and storing a new file list object in $fl but then you load the actual file list you want into $fs using a static function. So $fl never gets your file list. You try to sort $fl and then store it in $set but at no point in your code does $fl ever have a loaded file list. Just swap your static function call out as shown below. Static function calls are great for when you don't have the class available, but when you already have loaded it... use it.

Loader::model('file_list');
$fl = new FileList();
$fs = $fl->getByName("myset");
$set = $fl->filterBySet($fs);
print_r ($set)
echo $set;
mikeyt55 replied on at Permalink Reply
mikeyt55
Great thanks for your help, I will play around a bit and see what I can get working. and let you know