How to show only one of multiple image in list view

Hi,

How to show only one of multiple image in list view??

I have used file upload > Ajax upload (limit 4 images)

When I request it to show in list view, it shows all the files uploaded. Is there any way to show only first image and rest all images on popup or in detail view.
 
Well, one option would be to set the "Show media in list" to "Slideshow". Then even though it'll still be showing all the images, you'll only see one displayed at a time, with < and > buttons to cycle through the carousel.

The only other way would be to override the list layout for that element, in:

./components/com_fabrik/views/form/tmpl/bootstrap/layouts/element/yourtable___yourelement/fabrik-element-fileupload-list.php

Replace 'yourtable___yourelement' with your full element name. And if you aren't using the default 'bootstrap' template, replace that with your template.

In your layout, you will be passed an array of all the rendered images, in $d->data. So you can just grab the first entry and echo that.

Code:
<?php
defined('JPATH_BASE') or die;
$d = $displayData;

// get the first item in the array, in a non-destructive way.
$firstFile = reset($d->data);

// if the array was empty, $firstFile will be false (empty).  So only echo it if it's not empty.
if ($firstFile) {
   echo $firstFile;
}

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top