Page 1 of 1
[solved] Preventing the Simplex slider from showing thumbs.
Posted: Mon May 06, 2013 7:08 am
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!
Re: Preventing the Simplex image slider from showing thumbs.
Posted: Mon May 06, 2013 7:45 am
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
Re: Preventing the Simplex image slider from showing thumbs.
Posted: Mon May 06, 2013 8:08 am
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.
Re: Preventing the Simplex image slider from showing thumbs.
Posted: Mon May 06, 2013 8:32 am
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
Re: Preventing the Simplex image slider from showing thumbs.
Posted: Mon May 06, 2013 8:37 am
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.
Re: Preventing the Simplex image slider from showing thumbs.
Posted: Mon May 06, 2013 9:02 am
by Bumble
jpg and Jpeg won't work indeed.. it's only JPG
Going to test your code now, thanks!
Re: Preventing the Simplex image slider from showing thumbs.
Posted: Mon May 06, 2013 9:07 am
by Bumble
@ Velden... The whole slider dissapeared..?
Re: Preventing the Simplex image slider from showing thumbs.
Posted: Mon May 06, 2013 9:47 am
by velden
Bumble wrote:@ Velden... The whole slider dissapeared..?
Well, I think it checks for the existence of thumb_. Change it to:
Re: Preventing the Simplex image slider from showing thumbs.
Posted: Mon May 06, 2013 10:13 am
by Bumble
velden wrote:Bumble wrote:@ Velden... The whole slider dissapeared..?
Well, I think it checks for the existence of thumb_. Change it to:
Slider works, but shows thumbnails as well
Re: Preventing the Simplex image slider from showing thumbs.
Posted: Mon May 06, 2013 10:17 am
by velden
Code: Select all
{if $one|strpos:'thumb_' === false}
Re: Preventing the Simplex image slider from showing thumbs.
Posted: Mon May 06, 2013 11:00 am
by Bumble
velden wrote:Code: Select all
{if $one|strpos:'thumb_' === false}
Thanks Velden, it works!