A
A
Anton2016-06-03 11:48:36
MODX
Anton, 2016-06-03 11:48:36

Does getImageList (MIGX) have a syntax for fetching unique field values ​​like MySql's DISTINCT?

Good afternoon!
Created a table in TV MIGX where the colors are listed. Colors can be repeated, but you need to display a list of colors without repetition.
I output like this:

<ul>
    </ul>

and naturally the word Red is displayed as many times as it is used in the table. And you only need 1 time.
Is it possible somehow elegantly, without additional. snippets make a request?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
display: block, 2016-06-03
@Anton2022

You can add the getImageList snippet
Example:
A piece of ~166 lines

// where filter
if (is_array($where) && count($where) > 0) {
    $items = $migx->filterItems($where, $items);
    if($splice) array_splice($items, $splice); //добавляем эту строку
}

The call to the snippet would be:

The splice parameter specifies the number of first elements to output from the selection.
If you need to display the last element of the selection, then we pass splice as the second parameter to the array_splice function.
php.net/manual/en/function.array-splice.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question