[solved] Preventing the Simplex slider from showing thumbs.

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
User avatar
Bumble
Forum Members
Forum Members
Posts: 32
Joined: Tue May 30, 2006 5:03 pm

[solved] Preventing the Simplex slider from showing thumbs.

Post by Bumble »

Hello all,

Have a small (and I hope simple) question.
I edited the Simplex template so that I can upload new images to the "teaser" document wich then will show in the slider.

CMSMadeSimple generates automatic thumbnails. Is there a way to prevent the slider to show images with "thumb" in their name?

Code: Select all

            <div class='banner-image cf'>
            {strip}
                {* you do not need a module for every simple site functionality. For example you can build a simple slideshow
                with php glob function (http://www.php.net/manual/en/function.glob.php) without wasting your system resources 
                by using modules or plugins.
                Below would search for files matching .jpg in folder named teaser in simplex theme folder *}
                {assign var='teaser' value='uploads/images/teaser/*.JPG'|glob}
                    {foreach from=$teaser item='one'}
                        <div><img src='{root_url}/{$one}' width='300' height='175' alt='' /></div>
Thanks in advance!
Last edited by Bumble on Mon May 06, 2013 11:00 am, edited 1 time in total.
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: Preventing the Simplex image slider from showing thumbs.

Post by Gregor »

What is the naming of the thumbnails? If that is a standard, f.i.:
thumb_<filename>.jpg
You could add a if statement after the {foreach......} to only show images and no thumbs.

{foreach from=$teaser item='one'}
if filename does not contain "thumb_"
<div><img src='{root_url}/{$one}' width='300' height='175' alt='' /></div>
{endif}
{/foreach}

Grtz., Gregor
User avatar
Bumble
Forum Members
Forum Members
Posts: 32
Joined: Tue May 30, 2006 5:03 pm

Re: Preventing the Simplex image slider from showing thumbs.

Post by Bumble »

Hi Gregor,

I'n not really a PHP guru..but i guess the code you given me won't work..?
The filenaming of the thumbnails is standard indeed.
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: Preventing the Simplex image slider from showing thumbs.

Post by Gregor »

More ment as pseudo code. I don't know the variables that are in "one", you can use the print_r function to check.

Depending on the outcome of the print_r you can use something:
{if $one->name != "thumb_%"}
<div><img src='{root_url}/{$one}' width='300' height='175' alt='' /></div>
{endif}

I'm not sure if this is working {if $one->name != "thumb_%"} Maybe a forum search might help you out.

Hope this helps,
Gregor
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Preventing the Simplex image slider from showing thumbs.

Post by velden »

Google....?

Code: Select all

         <div class='banner-image cf'>
            {strip}
                {* you do not need a module for every simple site functionality. For example you can build a simple slideshow
                with php glob function (http://www.php.net/manual/en/function.glob.php) without wasting your system resources
                by using modules or plugins.
                Below would search for files matching .jpg in folder named teaser in simplex theme folder *}
                {assign var='teaser' value='uploads/images/teaser/*.JPG'|glob}
                    {foreach from=$teaser item='one'}
{if $one|strpos:'thumb_'===0}
                        <div><img src='{root_url}/{$one}' width='300' height='175' alt='' /></div>
{/if}
...
Further, I would do some tests with filename extensions like 'jpg' and 'Jpg'. Don't know if those are found because you defined your query with 'JPG' (uppercase).
Maybe you could even skip the thumb_-files in that 'query' but I don't know for sure.
User avatar
Bumble
Forum Members
Forum Members
Posts: 32
Joined: Tue May 30, 2006 5:03 pm

Re: Preventing the Simplex image slider from showing thumbs.

Post by Bumble »

jpg and Jpeg won't work indeed.. it's only JPG

Going to test your code now, thanks!
User avatar
Bumble
Forum Members
Forum Members
Posts: 32
Joined: Tue May 30, 2006 5:03 pm

Re: Preventing the Simplex image slider from showing thumbs.

Post by Bumble »

@ Velden... The whole slider dissapeared..?
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Preventing the Simplex image slider from showing thumbs.

Post by velden »

Bumble wrote:@ Velden... The whole slider dissapeared..?
Well, I think it checks for the existence of thumb_. Change it to:

Code: Select all

{if $one|strpos:'thumb_' !== 0}
User avatar
Bumble
Forum Members
Forum Members
Posts: 32
Joined: Tue May 30, 2006 5:03 pm

Re: Preventing the Simplex image slider from showing thumbs.

Post by Bumble »

velden wrote:
Bumble wrote:@ Velden... The whole slider dissapeared..?
Well, I think it checks for the existence of thumb_. Change it to:

Code: Select all

{if $one|strpos:'thumb_' !== 0}
Slider works, but shows thumbnails as well
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Preventing the Simplex image slider from showing thumbs.

Post by velden »

Code: Select all

{if $one|strpos:'thumb_' === false}
User avatar
Bumble
Forum Members
Forum Members
Posts: 32
Joined: Tue May 30, 2006 5:03 pm

Re: Preventing the Simplex image slider from showing thumbs.

Post by Bumble »

velden wrote:

Code: Select all

{if $one|strpos:'thumb_' === false}
Thanks Velden, it works!
Post Reply

Return to “CMSMS Core”