Page 1 of 1

[SOLVED] dynamic gallery in a single html-block

Posted: Wed Dec 29, 2010 2:21 pm
by ARVANDERKAMP
Got a little bit of a challenge for you all (or not).

First, let me show you the site/page what it's all about: http://websitedelivery.nl/Texeltrips/in ... ingplanner

As you can see there is a gallery on the right (Gallery module). Works fine! But now i want to use this gallery on several pages, off course with other images (other directories from the Gallery). Also no problem, this works with the dir="" tag from the Gallery.

But here's my problem. I don't want to add 10 HTML content blocks (sidebars) and templates, but i just want to add one block with a dynamic code in it so it works for all of the gallery's.

I allready searched a lot of forums, but didn't find the answer. To give you guys a headstart, i think it should be something like this:

{if page='texelopties' gallery dir="texelopties"}
{if page='weddingplanner' gallery dir="weddingplanner"} etc etc..

Could you guys please help me out?

Thanks a lot.

Re: dynamic gallery in a single html-block

Posted: Wed Dec 29, 2010 2:36 pm
by RonnyK
and is the gallery f.e. the same as the page you want to show the gallery on, or its parent?

As you could call something like dir=$page_alias f.e.

Ronny

Re: dynamic gallery in a single html-block

Posted: Wed Dec 29, 2010 2:45 pm
by M@rtijn
I think Ronny's option is a good one, but if you don't want the folders to be called the same as your page aliases, another possibility might be to do is as follows:

Code: Select all

{if $page_alias eq 'name1'}{Gallery dir='folder1'}
{elseif $page_alias eq 'name2'}{Gallery dir='folder2'}
{elseif $page_alias eq 'name3'}{Gallery dir='folder3'}
{else}{Gallery dir='folderX'}
{/if}

Re: dynamic gallery in a single html-block

Posted: Wed Dec 29, 2010 3:05 pm
by ARVANDERKAMP
Yeahhh, you're the man! It works! Veryy nice. I left the last one, behind the {else}, blank; so it doesn't show the gallery on other pages.

For people having the same problem, here's the code that did it for me:

Code: Select all

{if $page_alias eq 'workshops'}{Gallery dir='Workshops'}
{elseif $page_alias eq 'zuiver-texel'}{Gallery dir='Zuiver-Texel'}
{elseif $page_alias eq 'texelopties'}{Gallery dir='Texelopties'}
{elseif $page_alias eq 'texelteam-games'}{Gallery dir='Texelteam-Games'}
{elseif $page_alias eq 'texel-experience'}{Gallery dir='Texel-Experience'}
{elseif $page_alias eq 'korte-activiteiten'}{Gallery dir='Korte-activiteiten'}
{else}
{/if}
M@rtijn wrote: I think Ronny's option is a good one, but if you don't want the folders to be called the same as your page aliases, another possibility might be to do is as follows:

Code: Select all

{if $page_alias eq 'name1'}{Gallery dir='folder1'}
{elseif $page_alias eq 'name2'}{Gallery dir='folder2'}
{elseif $page_alias eq 'name3'}{Gallery dir='folder3'}
{else}{Gallery dir='folderX'}
{/if}

Re: [SOLVED] dynamic gallery in a single html-block

Posted: Wed Dec 29, 2010 6:28 pm
by RonnyK
This almost sounds like what I showed ;)

{Gallery dir=$page_alias}

Only the albums would than have to be lowercase, and a single line would be enough then :D

Ronny