Simplex Image slider [CMSMS 1.11.4 “Fernandina”]

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
User avatar
Bumble
Forum Members
Forum Members
Posts: 32
Joined: Tue May 30, 2006 5:03 pm

Simplex Image slider [CMSMS 1.11.4 “Fernandina”]

Post by Bumble »

Hello all,

On one of my sites I'm using the Simplex slider.
I'm trying to figure out what the criteria are for it to show images and in wich order they appear.
I really can't find any logic. It displays always the same image first.
Does anyone know a way to set it up to show it ascending on filename?

The code I'm using is:

Code: Select all

{strip}
                {assign var='teaser' value='uploads/images/teaser/*.jpg'|glob}
                    {foreach from=$teaser item='one'}
{if $one|strpos:'thumb_' === false}
                        <div><img src='{root_url}/{$one}' width='970' height='500' alt='' /></div>
                   {/if} {/foreach}
            </div>
I'm also trying to get it displaying images with both .jpg and .JPG extensions. Anyone?

Thanks a lot in advance!
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: Simplex Image slider [CMSMS 1.11.4 “Fernandina”]

Post by JohnnyB »

I wonder if @array_rand OR @shuffle will help (I didn't test).

{foreach from=$teaser|@array_rand item='one'}
{foreach from=$teaser|@shuffle item='one'}

You might have to shuffle or random the $teaser using {capture} or {assign} before you loop through with a foreach. Maybe,

{assign var='randomteaser' value=$teaser|@array_rand}
{foreach from=$randomteaser item='one'}
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Simplex Image slider [CMSMS 1.11.4 “Fernandina”]

Post by velden »

Just did a simple test and it seems to do what you want by default:

Code: Select all

{assign var='teaser' value='uploads/images/producten/*.png'|glob}
<pre>{$teaser|print_r}</pre>
Result:

Code: Select all

Array
(
    [0] => uploads/images/producten/10.png
    [1] => uploads/images/producten/11.png
    [2] => uploads/images/producten/12.png
    [3] => uploads/images/producten/1.png
    [4] => uploads/images/producten/2.png
    [5] => uploads/images/producten/3.png
    [6] => uploads/images/producten/4.png
    [7] => uploads/images/producten/5.png
    [8] => uploads/images/producten/6.png
    [9] => uploads/images/producten/7.png
    [10] => uploads/images/producten/8.png
    [11] => uploads/images/producten/9.png
    [12] => uploads/images/producten/news2.png
)
1
Post Reply

Return to “The Lounge”