Я загрузил следующие изображения:
Код: Выделить всё
image 1 (an image is uploaded)
image 2 (no image is uploaded)
image 3 (an image is uploaded)
image 4 (no image is uploaded)
image 5 (an image is uploaded)
image 6 (an image is uploaded)
и хотите отображать метки в том порядке, в котором эти изображения загружаются, например:
Код: Выделить всё
image 1
image 2
image 3
image 4
(without image 2 and image 4 as they are not uploaded)
Код: Выделить всё
[list]
{capture $featuredtLabel}{__ 'Image 1'}{/capture}
{capture $defaultLabel}{__ 'Image'}{/capture}
{foreach $galleryItems as $item}
[*]first} active{/if}">
{var $label = !empty($item['title']) ? $featuredtLabel : ($defaultLabel . ' ' . $iterator->counter)}
[url=#]{!$label}[/url]
{/foreach}
[/list]
Код: Выделить всё
image 1
image 2
image 3
image 4
image 5
image 6
Код: Выделить всё
[list]
{capture $featuredtLabel}{__ 'Image 1'}{/capture}
{capture $defaultLabel}{__ 'Image'}{/capture}
{foreach $galleryItems as $item}
[*]first} active{/if}">
{if !empty($item['image'])}
{if empty($item['imageUrl'])}
{var $iterator1 = $iterator->counter - 1}
{/if}
{var $iterator1 = $iterator->counter}
{var $label = !empty($item['title']) ? $featuredtLabel : ($defaultLabel . ' ' . $iterator1)}
[url=#]{!$label}[/url]
{/if}
{/foreach}
[/list]
Приведенные выше коды генерируют следующее результаты:
Код: Выделить всё
image 1
image 3
image 5
image 6
Код: Выделить всё
image 1
image 2
image 3
image 4
Подробнее здесь: https://stackoverflow.com/questions/787 ... -correctly
Мобильная версия