Fileset sortable display order. HOW TO?
Permalink 3 users found helpful
Does anybody know how to display images from a filset in display order. This is a new function in C5 v5.4. In Dashboard->FileManger->FileSets->Edit you can now change the display order for your files.
BUT ... HOW TO GET THE DISPLAY ORDER. I Want to build a custom gallery block etc.
BUT ... HOW TO GET THE DISPLAY ORDER. I Want to build a custom gallery block etc.
Wow that's it! Thanks a lot ... her is my function to get (echo) all images from an FileSet in display order:
I use it in conjunction with
Loader::model('file_set'); Loader::model('file_list'); /* * Returns an array of all ImageFileObjects from an given FileSet in display order * $fsId:INT the filsetID */ function getImagesFromFileSet($fsId) { $myFileSet = FileSet::getByID($fsId); $myFileList = new FileList(); $myFileList->filterBySet($myFileSet); $myFileList->filterByType(FileType::T_IMAGE); $myFileList->sortBy("fsDisplayOrder", 'asc'); $myImages = $myFileList->get(); return $myImages; }
I use it in conjunction with
$images = getImagesFromFileSet($fileSetID); function echoGalleryImages($images) { for ($n = 0; $n < count($images); $n++) { echoImage($images[$n]); } } function echoImage($file) { $src = $file->getRelativePath(); $alt = $file->getTitle(); echo "<img alt='$alt' src='$src' />"; //echo $src . "<br /><br />"; }
Please can you make my answer. I am trying to build up my profile.
Thanks Vijay
Thanks Vijay
You can use
For more details have a look at the given link, it may help you
http://www.concrete5.org/documentation/developers/system/searching-...