Page 1 of 1

Exclude Sub Gallery [SOLVED]

Posted: Mon Feb 10, 2014 10:47 am
by JM6891
Hi there,

I am using the Gallery module and currently all galleries are set up as subgalleries of the main {gallery}. However, I now need to add a subgallery which I do not want to display on the front end as part of the main {gallery} directory. Is it possible to exclude a subgallery? I've tried to find instructions on how to do this and even tried checking the gallery id but it seems it checks the gallery id of the current gallery, rather than the sub gallery.

Any help much appreciated.

Many thanks

Re: Exclude Sub Gallery

Posted: Mon Feb 10, 2014 10:58 am
by paulbaker

Re: Exclude Sub Gallery

Posted: Mon Feb 10, 2014 11:02 am
by JM6891
Hi thank you for your reply. I actually worked around it using:

Code: Select all

{foreach from=$images item=image}
{if ($image->file) != 'http://www.domain.co.uk/gallery/subgallery/59.html'}
	<div class="img">

	{if $image->isdir}

		<a href="{$image->file}" title="{$image->title}"><img src="{$image->thumb}" alt="{$image->title}" /></a><br />
		{$image->title}

	{else}
   <a href="{$image->file}" title="{$image->title}" rel="lightbox[gallery]"><img src="{$image->thumb}" alt="{$image->title}" /></a>
	{/if}

	</div>
{/if}
{/foreach}
This is a manual edit but it works for what I need. It basically checks the sub gallery is not equal to the full url inserted.

Re: Exclude Sub Gallery [SOLVED]

Posted: Mon Feb 10, 2014 1:26 pm
by velden
Although 'solved' I'd like to comment:

I think a solution with hardcoded url (or whatever) should be prevented if possible.

Why don't you add an extra checkbox field (Gallery -> Field definitions tab) to the Gallery? It would be reusable for any other sub gallery added in the future. And if something changes (like domain name for example) it continues to work for you.

Re: Exclude Sub Gallery [SOLVED]

Posted: Mon Feb 10, 2014 8:51 pm
by JM6891
thank you for your reply! I completely agree! A hard coded option should be avoided, however in this instance time was against me, though I do plan to go back and make it more dynamic when I have a bit more time... thank you for the tip! this will be handy indeed and I'll update this thread with a better solution when I've got one working!